为什么我得到“不是NamedXAResource”在Apache Karaf 4.0.4? [英] Why am I getting "is not a NamedXAResource" in Apache Karaf 4.0.4?

查看:180
本文介绍了为什么我得到“不是NamedXAResource”在Apache Karaf 4.0.4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些交易代码在旧版本的Apache Karaf中工作得非常好。现在在Apache Karaf 4.0.4中我看到很多例外。

I have some transactional code that worked very well in old versions of Apache Karaf. Now in Apache Karaf 4.0.4 I see a lot of exceptions.

java.lang.IllegalStateException:无法将事务记录为org.apache.derby.jdbc.EmbedXAResource@77cbf3e5不是NamedXAResource。

org.apache.aries.transaction.manager - 1.3.0 |请更正集成并提供NamedXA
java.lang.IllegalStateException:无法将事务记录为TransactionContext {transactionId = null,connection = ActiveMQConnection

推荐答案

我找到答案并在此发布,以便让其他人更快地解决同样的问题。我花了很长时间和Guillaume帮助解决这个问题。

I found the answer and post it here to give others a quicker way to solve the same problem. It took me quite a while and some help from Guillaume to figure this out.

在Aries事务管理器包内的Apache Karaf中使用的geronimo事务管理器可以恢复事务。默认情况下,此功能在较旧的karaf版本中关闭。在Apache Karaf 4.0.4中,这已经发生了变化。

The geronimo transaction manager that is used in Apache Karaf inside the Aries transaction manager bundle can recover transactions. By default this feature is switched off in older karaf versions. In Apache Karaf 4.0.4 this has changed.

config etc / org.apache.aries.transaction.cfg包含此设置

The config etc/org.apache.aries.transaction.cfg contains this setting

aries.transaction.recoverable = true

它激活恢复支持。这样做的缺点是所有jdbc和jms Connections必须实现NamedXAResource。这超出了标准,因此大多数jdbc和jms提供程序都不支持这一点。

It activates the recovery support. The downside of this is that all jdbc and jms Connections must then implement NamedXAResource. This is outside the standard so most jdbc and jms providers do not support this.

ActiveMQ的解决方案是使用JCAPoolingConnectionFactory。对于jdbc,您可以使用aries事务jdbc包装XADataSource。它提供了一个支持恢复的池化支持。

The solution for ActiveMQ is to use the JCAPoolingConnectionFactory. For jdbc you can wrap your XADataSource using aries transaction jdbc. It provides a pooling support that also supports recovery.

如果您对应用程序的工作方式感到满意,只需将上述开关设置为false即可。然后,交易将像旧的Apache Karaf版本一样工作。

If you are happy with how your application worked before you can simply set the above switch back to false. The transactions will then work like in older Apache Karaf versions.

这篇关于为什么我得到“不是NamedXAResource”在Apache Karaf 4.0.4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆