1 Reply Latest reply on Oct 8, 2014 7:53 PM by Brock M

    "Not a transacted session" error when using Camel-based application with A-MQ 6.1

    Marek Strejczek Newbie

      Hi, 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

        • 1. Re: "Not a transacted session" error when using Camel-based application with A-MQ 6.1
          Brock M Newbie

          Hi

           

          Yes I get the same issue, I'm running a Camel 2.13.2 app on JBoss EAP 6.2 with JBoss a-mq 6.1 as the broker (I've also got DB2 as an XA datasource) and using the activemq-rar-5.9.0.redhat-610379.rar resource adapter. I haven't being able to work out what's causing it. I've got the jms.rmIdFromConnectionId=true and <xa-pool> <is-same-rm-override>false</is-same-rm-override> set. I'm going to try it with the non-fuse 5.9 ra and see if it magically goes away..

           

          2014-10-09 10:40:33.392 WARN  [Camel (myapp-context) thread #3 - JmsConsumer[SomeQueue.ReceiveEvent.Q]] [] [org.apache.camel.component.jms.DefaultJmsMessageListenerContainer] Setup of JMS message listener invoker failed for destination 'SomeQueue.ReceiveEvent.Q' - 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)

            at org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:389)

            at org.springframework.transaction.support.ResourceHolderSynchronization.afterCommit(ResourceHolderSynchronization.java:79)

            at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133)

            at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerAfterCommit(TransactionSynchronizationUtils.java:121)

            at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCommit(AbstractPlatformTransactionManager.java:951)

            at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:797)

            at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)

            at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257)

            at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)

            at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)

            at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)

            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

            at java.lang.Thread.run(Thread.java:745)

          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)

            at org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:404)

            ... 14 more