javax.jms.TransactionInProgressException: Cannot rollback() inside an XASession
--------------------------------------------------------------------------------
Key: AMQ-3251
URL: https://issues.apache.org/jira/browse/AMQ-3251
Project: ActiveMQ
Issue Type: Bug
Components: Broker
Affects Versions: 5.4.2
Environment: Fuse ESB - 4.3.1-01-09
Reporter: Charles Moulliard
The following error is generated when trying to configure ActiveMQ with JTA/XA
{code}
15:09:39,373 | WARN | tenerContainer-1 | PooledSession | 47
- org.apache.activemq.activemq-pool - 5.4.2.fuse-03-09 | Caught exception
trying rollback() when putting session back into the pool:
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)
at org.apache.activemq.pool.PooledSession.close(PooledSession.java:111)
at
org.apache.activemq.pool.XaConnectionPool$Synchronization.afterCompletion(XaConnectionPool.java:90)
at
org.apache.geronimo.transaction.manager.TransactionImpl.afterCompletion(TransactionImpl.java:542)
at
org.apache.geronimo.transaction.manager.TransactionImpl.afterCompletion(TransactionImpl.java:535)
at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:326)
at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:250)
at
org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1009)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at
org.apache.aries.transaction.GeronimoPlatformTransactionManager.commit(GeronimoPlatformTransactionManager.java:76)
at sun.reflect.GeneratedMethodAccessor519.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_24]
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)[60:org.springframework.aop:3.0.5.RELEASE]
at $Proxy409.commit(Unknown Source)[:]
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257)[110:org.springframework.jms:3.0.5.RELEASE]
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)[110:org.springframework.jms:3.0.5.RELEASE]
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)[110:org.springframework.jms:3.0.5.RELEASE]
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)[110:org.springframework.jms:3.0.5.RELEASE]
at java.lang.Thread.run(Thread.java:680)[:1.6.0_24]
15:09:39,381 | WARN | tenerContainer-1 | Transaction | 49
- org.apache.aries.transaction.manager - 0.2.0.incubating | Unexpected
exception from afterCompletion; continuing
java.lang.RuntimeException: javax.jms.JMSException: Failed to invalidate
session: org.apache.activemq.AlreadyClosedException: Cannot use The session has
already been closed as it has already been closed
at
org.apache.activemq.pool.XaConnectionPool$Synchronization.afterCompletion(XaConnectionPool.java:93)
at
org.apache.geronimo.transaction.manager.TransactionImpl.afterCompletion(TransactionImpl.java:542)
at
org.apache.geronimo.transaction.manager.TransactionImpl.afterCompletion(TransactionImpl.java:535)
at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:326)
at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:250)
at
org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1009)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at
org.apache.aries.transaction.GeronimoPlatformTransactionManager.commit(GeronimoPlatformTransactionManager.java:76)
at sun.reflect.GeneratedMethodAccessor519.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_24]
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)[71:org.springframework.osgi.core:1.2.0]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[60:org.springframework.aop:3.0.5.RELEASE]
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)[60:org.springframework.aop:3.0.5.RELEASE]
at $Proxy409.commit(Unknown Source)[:]
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257)[110:org.springframework.jms:3.0.5.RELEASE]
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)[110:org.springframework.jms:3.0.5.RELEASE]
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)[110:org.springframework.jms:3.0.5.RELEASE]
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)[110:org.springframework.jms:3.0.5.RELEASE]
at java.lang.Thread.run(Thread.java:680)[:1.6.0_24]
Caused by: javax.jms.JMSException: Failed to invalidate session:
org.apache.activemq.AlreadyClosedException: Cannot use The session has already
been closed as it has already been closed
at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
at
org.apache.activemq.pool.SessionPool.invalidateSession(SessionPool.java:77)
at org.apache.activemq.pool.PooledSession.close(PooledSession.java:123)
at
org.apache.activemq.pool.XaConnectionPool$Synchronization.afterCompletion(XaConnectionPool.java:90)
... 33 more
Caused by: org.apache.activemq.AlreadyClosedException: Cannot use The session
has already been closed as it has already been closed
at
org.apache.activemq.pool.PooledSession.getInternalSession(PooledSession.java:291)
at
org.apache.activemq.pool.SessionPool.destroyObject(SessionPool.java:90)
at
org.apache.commons.pool.impl.GenericObjectPool.invalidateObject(GenericObjectPool.java:1258)
at
org.apache.activemq.pool.SessionPool.invalidateSession(SessionPool.java:75)
{code}
Here is the config used to access to AMQ Broker
{code}
<!-- Tx Manager -->
<osgi:reference id="txManager"
interface="org.springframework.transaction.PlatformTransactionManager"/>
<!-- Transaction POLICY used by Camel Transactional Route
We refer to the ServiceMiX TxManager -->
<bean id="PROPAGATION_REQUIRED"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="txManager"/>
</bean>
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<!-- <property name="configuration" ref="jmsConfig"/> -->
<property name="connectionFactory">
<osgi:reference interface="javax.jms.ConnectionFactory"/>
</property>
<property name="transactionManager" ref="txManager"/>
<property name="transacted" value="true"/>
<property name="cacheLevel" value="0" />
</bean>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route id="queue-create-incident">
<from uri="activemq:queue:incident"/>
<transacted ref="PROPAGATION_REQUIRED"/>
<log message=">>> Incident received : ${body}"/>
<bean ref="processIncident" method="saveReport"/>
<!-- <bean ref="processIncident" method="generateError"/> -->
<log message=">>> Record inserted : ${body}"/>
</route>
2) ActiveMQ
<bean id="activemqConnectionFactory"
class="org.apache.activemq.ActiveMQXAConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
<property name="redeliveryPolicy" ref="redeliveryPolicy"/>
</bean>
<bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.XaPooledConnectionFactory">
<property name="maxConnections" value="8" />
<property name="connectionFactory" ref="activemqConnectionFactory" />
<property name="transactionManager" ref="transactionManager"/>
</bean>
<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="0"/>
</bean>
<reference id="transactionManager"
interface="javax.transaction.TransactionManager" />
<service ref="pooledConnectionFactory"
interface="javax.jms.ConnectionFactory">
<service-properties>
<entry key="name" value="localhost"/>
</service-properties>
</service>
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira