0

昨天我尝试将我的包从 ServiceMix 4.4.1 迁移到 Fuse ESB Enterprise 7.1.0。带有本地事务的捆绑包可以正常工作,但其他带有 XA 事务的捆绑包不能正常工作。他们将带有以下消息的连续回溯写入日志文件:

13:30:29,283 | WARN | cation-stageOne] | PooledSession | 139 - org.apache.activemq.activemq-spring - 5.7.0.fuse-71-047 | Caught exception trying rollback() when putting session back into the pool, will invalidate. javax.jms.TransactionInProgressException: Cannot rollback() inside an XASession
javax.jms.TransactionInProgressException: Cannot rollback() inside an XASession
at org.apache.activemq.ActiveMQXASession.rollback(ActiveMQXASession.java:76)279:org.apache.activemq.activemq-core:5.7.0.fuse-71-047
at org.apache.activemq.pool.PooledSession.close(PooledSession.java:120)139:org.apache.activemq.activemq-spring:5.7.0.fuse-71-047
at org.springframework.jms.connection.JmsResourceHolder.closeAll(JmsResourceHolder.java:193)153:org.springframework.jms:3.0.7.RELEASE
at org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.releaseResource(ConnectionFactoryUtils.java:412)153:org.springframework.jms:3.0.7.RELEASE
at org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.releaseResource(ConnectionFactoryUtils.java:1)153:org.springframework.jms:3.0.7.RELEASE
at org.springframework.transaction.support.ResourceHolderSynchronization.afterCompletion(ResourceHolderSynchronization.java:98)148:org.springframework.transaction:3.0.7.RELEASE
at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:168)148:org.springframework.transaction:3.0.7.RELEASE
at org.springframework.transaction.support.AbstractPlatformTransactionManager.invokeAfterCompletion(AbstractPlatformTransactionManager.java:996)148:org.springframework.transaction:3.0.7.RELEASE
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:971)148:org.springframework.transaction:3.0.7.RELEASE
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:799)148:org.springframework.transaction:3.0.7.RELEASE
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)148:org.springframework.transaction:3.0.7.RELEASE
at org.apache.aries.transaction.GeronimoPlatformTransactionManager.commit(GeronimoPlatformTransactionManager.java:76)
at sun.reflect.GeneratedMethodAccessor243.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25):1.6.0_35
at java.lang.reflect.Method.invoke(Method.java:597):1.6.0_35
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)114:org.springframework.osgi.core:1.2.1
at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)114:org.springframework.osgi.core:1.2.1
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)114:org.springframework.osgi.core:1.2.1
at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)114:org.springframework.osgi.core:1.2.1
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)114:org.springframework.osgi.core:1.2.1
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)110:org.springframework.aop:3.0.7.RELEASE
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)110:org.springframework.aop:3.0.7.RELEASE
at $Proxy178.commit(Unknown Source)[:]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257)153:org.springframework.jms:3.0.7.RELEASE
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)153:org.springframework.jms:3.0.7.RELEASE
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)153:org.springframework.jms:3.0.7.RELEASE
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)153:org.springframework.jms:3.0.7.RELEASE
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886):1.6.0_35
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908):1.6.0_35
at java.lang.Thread.run(Thread.java:662):1.6.0_35

它发生在一个空队列中。

我的 activemq 端点配置如下所示:

<osgi:reference id="osgiPlatformTransactionManager" interface="org.springframework.transaction.PlatformTransactionManager"/>
<osgi:reference id="osgiJtaTransactionManager" interface="javax.transaction.TransactionManager"/>

<bean id="jmstx" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="configuration" ref="jmsTxConfig" />
</bean>

<bean id="jmsTxConfig" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="jmsXaPoolConnectionFactory"/>
    <property name="transactionManager" ref="osgiPlatformTransactionManager"/>
    <property name="transacted" value="true"/>
    <property name="cacheLevelName" value="CACHE_NONE"/>
    <property name="concurrentConsumers" value="${jms.concurrentConsumers}" />
</bean>

<bean id="jmsXaPoolConnectionFactory" class="org.apache.activemq.pool.XaPooledConnectionFactory">
    <property name="maxConnections" value="${jms.maxConnections}" />
    <property name="connectionFactory" ref="jmsXaConnectionFactory" />
    <property name="transactionManager" ref="osgiJtaTransactionManager" />
</bean>

<bean id="jmsXaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
    <property name="brokerURL" value="${jms.broker.url}"/>
    <property name="redeliveryPolicy">
        <bean class="org.apache.activemq.RedeliveryPolicy">
            <property name="maximumRedeliveries" value="-1"/>
            <property name="initialRedeliveryDelay" value="2000" />
            <property name="redeliveryDelay" value="5000" />
        </bean>
    </property>
</bean>

该端点在骆驼上下文中非常容易使用,如下所示:

<route id="route">
    <from uri="jmstx:queue:somequeue" />
    <!-- some logic here -->
</route>

如果有人可以帮助我解决这个问题,我会很高兴。如有必要,我可以提供更多细节。


编辑

似乎问题与 JMS 连接池有关:当我将连接工厂更改为简单的 ActiveMQXAConnectionFactory 时,异常消失了。

4

1 回答 1

0

这是 5.7.0 版(很可能是早期版本)的 activemq-pool 中的一个已知问题,并且已报告http://fusesource.com/issues/browse/ENTMQ-441

于 2013-10-26T02:08:22.040 回答