0 Replies Latest reply on Nov 8, 2016 1:28 PM by Suresh Selvam

    Jms with spring DefaultMessageListenerContainer in Jboss EAP 7

    Suresh Selvam Newbie

      Hi All ,

       

      I have faced the below issue with Jboss EAP 7 - artemis activemq when i try to commit the transaction locally.

       

      Issue:

      org.springframework.jms.IllegalStateException: Session is not transacted; nested exception is javax.jms.IllegalStateException: Session is not transacted

       

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

      [Server:server1]        at java.lang.Thread.run(Thread.java:745)

      [Server:server1] Caused by: javax.jms.IllegalStateException: Session is not transacted

      [Server:server1]        at org.apache.activemq.artemis.ra.ActiveMQRASession.commit(ActiveMQRASession.java:379)

       

      Below are my configuration.

       

      Spring context file :

       

          <jee:jndi-lookup id="MyMessagingConnectionFactory" jndi-name="com/jms/MyConnectionFactory" lookup-on-startup="false" proxy-interface="javax.jms.ConnectionFactory"/>

       

      <bean id="subscribeServiceListenerContainer"

                  class="org.springframework.jms.listener.DefaultMessageListenerContainer"

                  p:connectionFactory-ref="MyMessagingConnectionFactory"

                  p:destinationName="com/jms/dest/MyQueue"

                  p:destinationResolver-ref="destinationResolver"

                  p:recoveryInterval="6000"

                  p:messageListener-ref="subscribeServiceMessageListener"

                  p:concurrentConsumers="${subscribeService.jms.min.consume:5}"

                  p:maxConcurrentConsumers="${subscribeService.jms.max.consume:10}"

                  p:receiveTimeout="5000"

                  p:transactionManager-ref="MytransactionManager"/>

              <bean id="subscribeServiceListenerContainer1"

                  class="org.springframework.jms.listener.DefaultMessageListenerContainer"

                  p:connectionFactory-ref="MyMessagingConnectionFactory"

                  p:destinationName="com/jms/dest/MyQueue1"

                  p:destinationResolver-ref="destinationResolver"

                  p:recoveryInterval="6000"

                  p:messageListener-ref="subscribeServiceMessageListener1"

                  p:concurrentConsumers="${subscribeService.jms.min.consume:5}"

                  p:maxConcurrentConsumers="${subscribeService.jms.max.consume:10}"

                  p:receiveTimeout="5000"

                  p:sessionTransacted="true"/>

       

      domain.xml:

       

      <subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">

                  <server name="default">

                      <jms-queue name="MyQueue" entries="java:com/jms/dest/MyQueue"/>

                       <jms-queue name="MyQueue1" entries="java:com/jms/dest/MyQueue1"/>

       

                      <connection-factory name="InVmConnectionFactory" connectors="in-vm" entries="java:/ConnectionFactory"/>

                      <connection-factory name="RemoteConnectionFactory" connectors="http-connector" entries="java:jboss/exported/jms/RemoteConnectionFactory"/>

                      <pooled-connection-factory name="activemq-ra" transaction="xa" connectors="in-vm" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory"/>

                      <pooled-connection-factory name="MyConnectionFactory" transaction="xa" client-id="MyClientId" entries="java:/com/jms/MyConnectionFactory" connectors="in-vm"/>

                  </server>

              </subsystem>

       

      In subscribeServiceMessageListener1, session.getTransacted() is always returned false even if that value was set to true in subscribeServiceListenerContainer1.

       

      Please help to me resolve this issue and I not sure why this p:sessionTransacted is not set to true.

       

      Note - The same code is working perfectly in Weblogic Server

       

      Thanks in Advance.