"Not a transacted session" error when using Camel-based application with A-MQ 6.1
maroos Aug 26, 2014 12:47 PMHi, it seems that Camel-based applications cannot consume messages from A-MQ 6.1 queues.
My setup:
* Camel-based application deployed on JBoss EAP.
* Resource adapter bundled with A-MQ 6.1 (activemq-rar-5.9.0.redhat-610379.rar) deployed in JBoss EAP.
* A-MQ 6.1 broker up and running.
The application gets connection factory from JNDI and registers a consumer on a queue. It uses XA transactions when consuming messages. The application created to illustrate the problem can be found here: https://github.com/mstrejczek/camelbasedjmsconsumer
The problem is that the application does not consume any messages, instead it emits the following warning every second:
17:03:59,956 WARN [org.apache.camel.component.jms.DefaultJmsMessageListenerContainer] (Camel (camel-1) thread #0 - JmsConsumer[TEST.QUEUE]) Setup of JMS message listener invoker failed for destination 'TEST.QUEUE' - trying to recover. Cause: Local JMS transaction failed to commit; nested exception is javax.jms.IllegalStateException: Not a transacted session: org.springframework.jms.connection.SynchedLocalTransactionFailedException: Local JMS transaction failed to commit; nested exception is javax.jms.IllegalStateException: Not a transacted session
at org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:407) [spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:389) [spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.transaction.support.ResourceHolderSynchronization.afterCommit(ResourceHolderSynchronization.java:79) [spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133) [spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerAfterCommit(TransactionSynchronizationUtils.java:121) [spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCommit(AbstractPlatformTransactionManager.java:951) [spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:797) [spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724) [spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257) [spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101) [spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093) [spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990) [spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: javax.jms.IllegalStateException: Not a transacted session
at org.apache.activemq.ActiveMQSession.commit(ActiveMQSession.java:558)
at org.apache.activemq.ra.ManagedSessionProxy.commit(ManagedSessionProxy.java:108)
at org.springframework.jms.connection.JmsResourceHolder.commitAll(JmsResourceHolder.java:184) [spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:404) [spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE]
... 14 more
The problem is only observed in the configuration described below. Everything works fine when I:
* use A-MQ 6.0 with A-MQ 6.0 RAR (activemq-rar-5.8.0.redhat-60024.rar)
* use A-MQ 6.1 with plain ActiveMQ RAR (activemq-rar-5.9.0.rar)
* use ActiveMQ 5.9.0 with plain ActiveMQ RAR (activemq-rar-5.9.0.rar)
* use an application that uses Spring DMLC directly, without Camel.
It makes me think that the problem lies in the RAR bundled with A-MQ 6.1 (activemq-rar-5.9.0.redhat-610379.rar), as the problem is not observed when using vanilla ActiveMQ RAR (activemq-rar-5.9.0.rar). Moreover, the issue must have been introduced in the A-MQ 6.1 version as everything worked great with A-MQ 6.0.
Has anyone experienced this problem, found a root cause or a solution?
Thanks,
Marek