昨日、バンドルを 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 に変更すると、例外が消えます。