1 2 Previous Next 18 Replies Latest reply on Aug 22, 2012 7:45 AM by Andy Taylor

    JBoss AS7 HornetQ (XA, Spring, Hibernate)

    renevanwijk Newbie

      In an application build with Spring (and Hibernate for the ORM) we have the following Spring configuration:

       

      {code:xml}

      <beans xmlns="http://www.springframework.org/schema/beans"

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"

            xmlns:jee="http://www.springframework.org/schema/jee"

            xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">

          <bean id="company" class="model.logic.CompanyBean">

              <property name="sessionFactory" ref="sessionfactory"/>

              <property name="jmsTemplate" ref="jmstemplate"/>

          </bean>

          <!-- Hibernate SessionFactory config -->

          <bean id="sessionfactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

              <property name="dataSource" ref="datasource"/>

              <property name="jtaTransactionManager" ref="transactionManager"/>

              <property name="mappingResources">

                  <list>

                      <value>model/entities/person.hbm.xml</value>

                  </list>

              </property>

              <property name="hibernateProperties">

                  <props>

                      <prop key="hibernate.dialect">${hibernate.dialect}</prop>

                      <prop key="hibernate.current_session_context_class">${hibernate.current_session_context_class}</prop>

                      <prop key="hibernate.listeners.envers.autoRegister">${hibernate.listeners.envers.autoRegister}</prop>

                      <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>

                      <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>

                  </props>

              </property>

          </bean>

          <!-- Transaction config -->

          <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>

          <tx:annotation-driven transaction-manager="transactionManager"/>

          <!-- Resource look-ups -->

          <jee:jndi-lookup id="datasource" jndi-name="java:/jdbc/OracleDS" resource-ref="false"/>

          <jee:jndi-lookup id="connectionfactory" jndi-name="java:/JmsXA" resource-ref="false"/>

          <jee:jndi-lookup id="destination" jndi-name="java:/queue/test" resource-ref="false"/>

          <!-- JMS config -->

          <bean id="jmstemplate" class="org.springframework.jms.core.JmsTemplate">

              <property name="connectionFactory" ref="connectionfactory"/>

              <property name="defaultDestination" ref="destination"/>

          </bean>

          <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">

              <property name="connectionFactory" ref="connectionfactory"/>

              <property name="destination" ref="destination"/>

              <property name="transactionManager" ref="transactionManager"/>

              <property name="messageListener" ref="companymdp"/>

          </bean>

          <bean id="companymdp" class="model.logic.CompanyMDP"/>

          <!-- Extra -->

          <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

              <property name="locations">

                  <list>

                      <value>classpath:spring.properties</value>

                  </list>

              </property>

          </bean>

      </beans>

      {code}

       

      The used resources (that are looked-up) are configured on JBoss as follows:

       

      {code:xml}

      <domain xmlns="urn:jboss:domain:1.1">

          ...

          <profiles>

              <profile name="cluster">

                  <subsystem xmlns="urn:jboss:domain:datasources:1.0">

                      <datasources>

                          <datasource jta="true" jndi-name="java:/jdbc/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true" use-ccm="true">

                              <connection-url>jdbc:oracle:thin:@192.168.1.60:1521:orcl11</connection-url>

                              <driver>oracle</driver>

                              <pool>

                                  <min-pool-size>1</min-pool-size>

                                  <max-pool-size>15</max-pool-size>

                                  <prefill>true</prefill>

                                  <use-strict-min>true</use-strict-min>

                              </pool>

                              <security>

                                  <user-name>example</user-name>

                                  <password>example</password>

                              </security>

                              <timeout>

                                  <idle-timeout-minutes>0</idle-timeout-minutes>

                                  <query-timeout>600</query-timeout>

                              </timeout>

                              <statement>

                                  <prepared-statement-cache-size>10</prepared-statement-cache-size>

                              </statement>

                          </datasource>

                          <drivers>

                              <driver name="oracle" module="com.oracle.database">

                                  <driver-class>oracle.jdbc.OracleDriver</driver-class>

                                  <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>

                              </driver>

                          </drivers>

                      </datasources>

                  </subsystem>

                  <subsystem xmlns="urn:jboss:domain:messaging:1.1">

                      <hornetq-server>

                              ...

                          <jms-connection-factories>

                                    ...

                              <pooled-connection-factory name="hornetq-ra">

                                  <transaction mode="xa"/>

                                  <connectors>

                                      <connector-ref connector-name="in-vm"/>

                                  </connectors>

                                  <entries>

                                      <entry name="java:/JmsXA"/>

                                  </entries>

                              </pooled-connection-factory>

                          </jms-connection-factories>

                          <jms-destinations>

                              <jms-queue name="testQueue">

                                  <entry name="java:/queue/test"/>

                                  <entry name="java:jboss/exported/jms/queue/test"/>

                              </jms-queue>

                                    ...

                          </jms-destinations>

                      </hornetq-server>

                  </subsystem>

                    ...

              </profile>

          </profiles>

          ...

          <deployments>

              <deployment name="LoadTest6.ear" runtime-name="LoadTest6.ear">

                  <content sha1="161f51dde7f085c822cc4c68b306d57f1bee902d"/>

              </deployment>

              <deployment name="SpringHibernate.war" runtime-name="SpringHibernate.war">

                  <content sha1="574d0617d92d8439844633557937be754a134370"/>

              </deployment>

          </deployments>

          <server-groups>

                ...

              <server-group name="cluster-group" profile="cluster">

                  <jvm name="default"/>

                  <socket-binding-group ref="cluster-sockets"/>

                  <deployments>

                      <deployment name="LoadTest6.ear" runtime-name="LoadTest6.ear"/>

                      <deployment name="SpringHibernate.war" runtime-name="SpringHibernate.war" enabled="false"/>

                  </deployments>

              </server-group>

          </server-groups>

      </domain>

      {code}

       

      In the jboss-deployment-structure looks as follows:

       

      {code:xml}

      <jboss-deployment-structure>

          <deployment>

              <dependencies>

                  <module name="org.springframework">

                          <imports>

                              <include path="META-INF**"/>

                              <include path="org**"/>

                          </imports>

                    </module>

              </dependencies>

          </deployment>

      </jboss-deployment-structure>

      {code}

       

      in which the org.springframework module has the following contents:

       

      {code:xml}

      <module xmlns="urn:jboss:module:1.1" name="org.springframework">  

          <resources>

          <resource-root path="aopalliance-1.0.jar"/>

          <resource-root path="cglib-2.2.2.jar"/>

          <resource-root path="commons-logging-1.0.4.jar"/>

          <resource-root path="org.springframework.aop-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.asm-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.beans-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.context-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.core-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.expression-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.jdbc-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.jms-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.orm-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.transaction-3.1.2.RELEASE.jar"/>

          <resource-root path="org.springframework.web-3.1.2.RELEASE.jar"/>

          </resources>

          <dependencies>

              <module name="javax.api" export="true"/>

              <module name="org.apache.log4j" export="true"/>

              <module name="org.antlr" export="true"/>

              <module name="org.dom4j" export="true"/>

              <module name="org.hibernate" export="true"/>

              <module name="javax.persistence.api" export="true"/>

              <module name="org.javassist" export="true"/>

              <module name="org.jboss.logging" export="true"/>

              <module name="javax.transaction.api" export="true"/>

              <module name="javax.jms.api" export="true"/>

          </dependencies>

      </module>

      {code}

       

      When the application is run, the following is observed:

       

      {code}

      # LOGGING CLUSTER SERVER 1

      09:33:20,815 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@74359b24: startup date [Fri Aug 17 09:33:20 CEST 2012]; root of context hierarchy

      09:33:20,945 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Loading XML bean definitions from class path resource [spring-config.xml]

      09:33:21,415 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Loading properties file from class path resource [spring.properties]

      09:33:21,441 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6c11e58: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,connectionfactory,destination,jmstemplate,org.springframework.jms.listener.DefaultMessageListenerContainer#0,companymdp]; root of factory hierarchy

      09:33:21,535 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@7e0cf590

      09:33:21,536 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@4d50b06b

      09:33:21,537 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@38d060ac

      09:33:21,784 INFO  [org.hibernate.annotations.common.Version] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

      09:33:21,792 INFO  [org.hibernate.Version] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000412: Hibernate Core {4.0.1.Final}

      09:33:21,794 INFO  [org.hibernate.cfg.Environment] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000206: hibernate.properties not found

      09:33:21,796 INFO  [org.hibernate.cfg.Environment] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000021: Bytecode provider name : javassist

      09:33:21,907 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!

      09:33:22,517 INFO  [org.hibernate.dialect.Dialect] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect

      09:33:22,539 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000397: Using ASTQueryTranslatorFactory

      09:33:22,652 INFO  [org.hibernate.validator.util.Version] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Hibernate Validator 4.2.0.Final

      09:33:23,152 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Starting beans in phase 2147483647

      09:33:23,552 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) INSERT 1chrw6b78f2w9 9719

      09:33:23,671 WARN  [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) Execution of JMS message listener failed, and no ErrorHandler has been set.: java.lang.RuntimeException: javax.jms.IllegalStateException: Non XA connection

          at model.logic.CompanyMDP.onMessage(CompanyMDP.java:16) [classes:]

          at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:326) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:244) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]

      Caused by: javax.jms.IllegalStateException: Non XA connection

          at org.hornetq.ra.HornetQRASession.getSession(HornetQRASession.java:1246)

          at org.hornetq.ra.HornetQRAMessage.acknowledge(HornetQRAMessage.java:71)

          at model.logic.CompanyMDP.onMessage(CompanyMDP.java:13) [classes:]

          ... 9 more

      {code}

       

      It is complaining about the connection not being XA (Non XA connection) - looking in the HornetQ documentation (http://docs.jboss.org/hornetq/2.2.14.Final/user-manual/en/html_single/index.html) it is shown that an XA-typed connection factory can be obtained when using the 'xa' element. But when this is used in the JBoss configuration (and the host controller and servers are restarted) the following error is observed in the host controller logging:

       

      {code}

      Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[697,29] Message: JBAS014789: Unexpected element '{urn:jboss:domain:messaging:1.1}xa' encountered

      {code}

       

      Looks like the 'urn:hornetq' is different than the 'urn:jboss:domain:messaging:1.1', so things that are shown in the HornetQ documentation cannot always be used in the JBoss messaging configuration.

       

      At first, I thought there was something wrong with the application, and set-up a similar environment in WebLogic. Here, it is working fine.

       

      I am missing something in the JBoss configuration (such as libraries, wrong config...)? More detailed information can be found here: http://middlewaremagic.com/weblogic/?p=8104.

      Note the application described above is simplified version of the real application (only involving the necessary resources - JMS, database and transactions)

        • 1. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
          Andy Taylor Master

          The resource adapter's connection factory is configured to use XA, this means all sessions created by this need to be XA, Spring is using this to create a non xa session so its correct to throw this exception. I know very little about Spring so I can't give you any advice on that, but if you are happy to use a non transacted pooled connection factory.

          • 2. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
            renevanwijk Newbie

            "The resource adapter's connection factory is configured to use XA, this means all sessions created by this need to be XA..."

             

            This is because <transaction mode="xa"/> is used in the configuration; Am I right here? (Is it also correct that the 'xa' element from the HornetQ documentation cannot be used?)

             

            "... Spring is using this to create a non xa session so its correct to throw this exception"

             

            This is a little weird, as the Spring documentation (http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/jms.html) states the following when

            the DefaultMessageListenerContainer is used:

            "This message listener container is the one used in most cases. In contrast to SimpleMessageListenerContainer, this container variant does allow for dynamic adaption to runtime demands and is able to participate in externally managed transactions. Each received message is registered with an XA transaction when configured with a JtaTransactionManager; so processing may take advantage of XA transaction semantics. This listener container strikes a good balance between low requirements on the JMS provider, advanced functionality such as transaction participation, and compatibility with Java EE environments."

             

            Correct if I am wrong, but it looks like Spring is expecting something to be XA, but it is not (in this case the connection factory).

             

            Indeed, the application is working fine when the SimpleMessageListenerContainer (this does not use any transactions) in conjuntion a non-XA connection factory, but as you might

            have guessed they want transactions (and a headache).

            • 3. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
              Andy Taylor Master

              "The resource adapter's connection factory is configured to use XA, this means all sessions created by this need to be XA..."

               

              This is because <transaction mode="xa"/> is used in the configuration; Am I right here? (Is it also correct that the 'xa' element from the HornetQ documentation cannot be used?)

              yes you are correct and no it cannot be used, this is not a HornetQ session factory but as AS7 pooled connection factory managed by the container. The available modes are xa, local and none.

               

              Correct if I am wrong, but it looks like Spring is expecting something to be XA, but it is not (in this case the connection factory).

               

              and as far as I am aware it is spring that is creating the session. As its spring its hard to say how and why it is doing this,  if it was an MDB it would be the resource adapter crating it, however it looks like is the handler of the CompanyMDP object that is doing it, what type of resource is this by the way?

              • 4. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                Ravi Bhardwaj Newbie

                Hello Rene,

                 

                It seems that the JMS connection that you are using is tranasted, however your MDP is not creating a JMS session.

                Could you try adding the following property in the Spring configuration?

                 

                <property name="sessionTransacted" value="true"/>

                 

                Please refer the following doc for the same:

                http://static.springsource.org/spring/docs/2.0.x/reference/jms.html


                Regards,
                Ravi Bhardwaj


                • 5. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                  renevanwijk Newbie

                  The comanymdp implements the messagelistener interface.

                  Sort of a message driven bean without any configuration.

                  This with the messaging resources are injected into a message listener

                  container. Based on the type of transaction manager that is used

                  in the case of the default container you get different type of

                  transaction semantics.

                   

                  In the case above JTA is used - in this case Spring expects the connection factory

                  to be of XA type.

                   

                  In a domain configuration (JBoss) you can create multiple conbection factories

                  some that are present is a basic in jvm and remote connection factory.

                  Is it possible to make aconnection factory XA enable.

                   

                  I tried it by adding the element xa to the configuration but this throws

                  a parsing exception.

                  • 6. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                    Andy Taylor Master

                    The comanymdp implements the messagelistener interface.

                    Sort of a message driven bean without any configuration.

                    This with the messaging resources are injected into a message listener

                    container. Based on the type of transaction manager that is used

                    in the case of the default container you get different type of

                    transaction semantics.

                    Ok its this that is creating a non xa session on an xa connection factory, have you tried Ravi's fix?

                    In a domain configuration (JBoss) you can create multiple conbection factories

                    some that are present is a basic in jvm and remote connection factory.

                    Is it possible to make aconnection factory XA enable.

                    like i said, the pooled connection factory is xa enabled

                     

                    If you can supply an example that i can easily deploy and run (in only a few minutes) I will take a look when i get time

                    • 7. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                      renevanwijk Newbie

                      Of course I will Ravi's suggestion, but I now not located at my machine.

                      When I am will add the suggestef config and try again and will

                      couple the results back.

                      • 8. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                        renevanwijk Newbie

                        Unfortunetaly, the sessionTransacted did not work (also included the logging of the startup - maybe it gives some extra information for the trained eye):

                         

                        19:07:47,989 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 32) JBAS015537: Activating WebServices Extension

                        19:07:48,074 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 36) JBAS013101: Activating Security Subsystem

                        19:07:48,096 INFO  [org.jboss.as.security] (MSC service thread 1-3) JBAS013100: Current PicketBox version=4.0.6.final

                        19:07:48,118 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 41) JBAS011940: Activating OSGi Subsystem

                        19:07:48,143 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 42) JBAS011800: Activating Naming Subsystem

                        19:07:48,185 INFO  [org.jboss.as.naming] (MSC service thread 1-4) JBAS011802: Starting Naming Service

                        19:07:48,266 INFO  [org.jboss.as.clustering.jgroups] (ServerService Thread Pool -- 49) JBAS010260: Activating JGroups subsystem.

                        19:07:48,380 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 55) JBAS010280: Activating Infinispan subsystem.

                        19:07:48,385 INFO  [org.jboss.as.jacorb] (ServerService Thread Pool -- 54) JBAS016300: Activating JacORB Subsystem

                        19:07:48,422 INFO  [org.jboss.as.connector] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)

                        19:07:48,429 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-3) JBAS015400: Bound mail session [java:jboss/mail/Default]

                        19:07:48,431 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 58) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

                        19:07:48,457 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 59) JBAS016200: Activating ConfigAdmin Subsystem

                        19:07:48,515 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-4) JBoss Web Services - Stack CXF Server 4.0.1.GA

                        19:07:48,685 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 58) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.2)

                        19:07:48,708 INFO  [org.apache.coyote.ajp.AjpAprProtocol] (MSC service thread 1-4) Starting Coyote AJP/1.3 on ajp--192.168.1.150-9080

                        19:07:48,707 INFO  [org.jboss.as.jaxr] (MSC service thread 1-1) Binding JAXR ConnectionFactory: java:jboss/jaxr/ConnectionFactory

                        19:07:48,723 INFO  [org.jboss.as.modcluster] (MSC service thread 1-3) JBAS011704: Mod_cluster uses default load balancer provider

                        19:07:48,824 INFO  [org.apache.coyote.http11.Http11AprProtocol] (MSC service thread 1-2) Starting Coyote HTTP/1.1 on http--192.168.1.150-8080

                        19:07:48,832 INFO  [org.jboss.modcluster.ModClusterService] (MSC service thread 1-3) Initializing mod_cluster 1.2.0.Final

                        19:07:48,991 INFO  [org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl] (MSC service thread 1-3) Listening to proxy advertisements on 224.0.1.105:23364

                        19:07:49,068 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 55) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be pasivated.

                        19:07:49,174 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 55) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be pasivated.

                        19:07:49,347 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-3) live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server1/data/messagingjournal,bindingsDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server1/data/messagingbindings,largeMessagesDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server1/data/messaginglargemessages,pagingDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server1/data/messagingpaging)

                        19:07:49,351 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-3) Waiting to obtain live lock

                        19:07:49,559 INFO  [org.hornetq.core.persistence.impl.journal.JournalStorageManager] (MSC service thread 1-3) Using AIO Journal

                        19:07:49,647 INFO  [org.jboss.as.jacorb] (MSC service thread 1-4) JBAS016330: CORBA ORB Service started

                        19:07:49,889 INFO  [org.hornetq.core.server.impl.AIOFileLockNodeManager] (MSC service thread 1-3) Waiting to obtain live lock

                        19:07:49,900 INFO  [org.hornetq.core.server.impl.AIOFileLockNodeManager] (MSC service thread 1-3) Live Server Obtained live lock

                        19:07:50,156 INFO  [org.jboss.as.jacorb] (MSC service thread 1-4) JBAS016328: CORBA Naming Service started

                        19:07:50,447 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

                        19:07:50,447 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:/jdbc/OracleDS]

                        19:07:50,516 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "SpringHibernate.war"

                        19:07:50,516 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "LoadTest6.ear"

                        19:07:50,518 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on axis-into-ict.nl/192.168.1.150:4447

                        19:07:50,717 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "Web.war"

                        19:07:50,717 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "Model.jar"

                        19:07:50,854 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for PersonPersistenceUnit

                        19:07:51,233 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named Company in deployment unit subdeployment "Model.jar" of deployment "LoadTest6.ear" are as follows:

                         

                         

                                  java:global/LoadTest6/Model/Company!model.logic.Company

                                  java:app/Model/Company!model.logic.Company

                                  java:module/Company!model.logic.Company

                                  java:jboss/exported/LoadTest6/Model/Company!model.logic.Company

                                  java:global/LoadTest6/Model/Company

                                  java:app/Model/Company

                                  java:module/Company

                         

                         

                        19:07:51,569 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011402: Starting Persistence Unit Service 'LoadTest6.ear/Model.jar#PersonPersistenceUnit'

                        19:07:51,652 INFO  [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-3) Started Netty Acceptor version 3.2.5.Final-a96d88c axis-into-ict.nl:5455 for CORE protocol

                        19:07:51,659 INFO  [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-3) Started Netty Acceptor version 3.2.5.Final-a96d88c axis-into-ict.nl:5445 for CORE protocol

                        19:07:51,673 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-3) Server is now live

                        19:07:51,674 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-3) HornetQ Server version 2.2.11.Final (HQ_2_2_11_FINAL_AS7, 122) [2e926cad-78e4-11e1-b1c7-000c2976c82d]) started

                        19:07:51,734 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) trying to deploy queue jms.queue.testQueue

                        19:07:51,804 INFO  [org.hibernate.annotations.common.Version] (MSC service thread 1-4) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

                        19:07:51,803 INFO  [org.jboss.as.messaging] (MSC service thread 1-1) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/test

                        19:07:51,811 INFO  [org.jboss.as.messaging] (MSC service thread 1-1) JBAS011601: Bound messaging object to jndi name java:/queue/test

                        19:07:51,814 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-3) trying to deploy queue jms.topic.testTopic

                        19:07:51,823 INFO  [org.hibernate.Version] (MSC service thread 1-4) HHH000412: Hibernate Core {4.0.1.Final}

                        19:07:51,824 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-4) HHH000206: hibernate.properties not found

                        19:07:51,826 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-4) HHH000021: Bytecode provider name : javassist

                        19:07:51,868 INFO  [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /SpringHibernate

                        19:07:51,877 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-4) HHH000204: Processing PersistenceUnitInfo [

                                  name: PersonPersistenceUnit

                                  ...]

                        19:07:51,885 INFO  [org.jboss.as.messaging] (MSC service thread 1-3) JBAS011601: Bound messaging object to jndi name java:/topic/test

                        19:07:51,889 INFO  [org.jboss.as.messaging] (MSC service thread 1-3) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/topic/test

                        19:07:51,910 INFO  [org.jboss.as.messaging] (MSC service thread 1-1) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory

                        19:07:51,923 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory

                        19:07:51,924 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/RemoteConnectionFactory

                        19:07:51,917 INFO  [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: /LoadTest6

                        19:07:52,012 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-2) JBAS010406: Registered connection factory java:/JmsXA

                        19:07:52,020 INFO  [org.hornetq.ra.HornetQResourceAdapter] (MSC service thread 1-2) HornetQ resource adaptor started

                        19:07:52,021 INFO  [org.jboss.as.connector.services.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-2) IJ020002: Deployed: file://RaActivatorhornetq-ra

                        19:07:52,036 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-3) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA]

                        19:07:52,064 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) JBAS014142: Started message driven bean 'CompanyMDB' with 'hornetq-ra' resource adapter

                        19:07:52,097 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-4) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider

                        19:07:52,218 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-4) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect

                        19:07:52,273 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-4) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory

                        19:07:52,277 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-4) HHH000397: Using ASTQueryTranslatorFactory

                        19:07:52,306 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-4) Hibernate Validator 4.2.0.Final

                        19:07:52,587 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "SpringHibernate.war"

                        19:07:52,588 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "LoadTest6.ear"

                        19:07:52,595 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 8264ms - Started 320 of 451 services (129 services are passive or on-demand)

                        19:07:58,458 INFO  [org.jboss.modcluster.ModClusterService] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Engine [jboss.web] will use jvmRoute: 2c78c6e8-7325-3857-8bfc-d957f56114dc

                        19:08:54,687 INFO  [org.jboss.modcluster.ModClusterService] (MSC service thread 1-2) All active sessions drained from context [/LoadTest6] in 0 seconds

                        19:08:54,802 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011403: Stopping Persistence Unit Service 'LoadTest6.ear/Model.jar#PersonPersistenceUnit'

                        19:08:54,821 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment Web.war in 169ms

                        19:08:54,822 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment Model.jar in 170ms

                        19:08:54,825 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment LoadTest6.ear in 173ms

                        19:08:54,894 INFO  [org.jboss.as.server] (host-controller-connection-threads - 1) JBAS018558: Undeployed "LoadTest6.ear"

                        19:09:03,513 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp--192.168.1.150-9080-3) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6046f6e4: startup date [Mon Aug 20 19:09:03 CEST 2012]; root of context hierarchy

                        19:09:03,550 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp--192.168.1.150-9080-3) Loading XML bean definitions from class path resource [spring-config.xml]

                        19:09:03,795 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ajp--192.168.1.150-9080-3) Loading properties file from class path resource [spring.properties]

                        19:09:03,815 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp--192.168.1.150-9080-3) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6d99723f: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,connectionfactory,destination,jmstemplate,org.springframework.jms.listener.DefaultMessageListenerContainer#0,companymdp]; root of factory hierarchy

                        19:09:03,869 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-3) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@68c50e46

                        19:09:03,870 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-3) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@37811015

                        19:09:03,871 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-3) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@5f58517d

                        19:09:03,892 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (ajp--192.168.1.150-9080-3) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!

                        19:09:03,952 INFO  [org.hibernate.dialect.Dialect] (ajp--192.168.1.150-9080-3) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect

                        19:09:03,955 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ajp--192.168.1.150-9080-3) HHH000397: Using ASTQueryTranslatorFactory

                        19:09:04,121 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (ajp--192.168.1.150-9080-3) Starting beans in phase 2147483647

                        19:09:04,324 INFO  [stdout] (ajp--192.168.1.150-9080-3) UPDATE 1sfmy4kjte7rf 7043

                        19:09:07,397 INFO  [stdout] (ajp--192.168.1.150-9080-3) INSERT 18x3kz9mvpir1 8684

                        19:09:07,471 WARN  [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) Execution of JMS message listener failed, and no ErrorHandler has been set.: java.lang.RuntimeException: javax.jms.IllegalStateException: Non XA connection

                                  at model.logic.CompanyMDP.onMessage(CompanyMDP.java:16) [classes:]

                                  at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                  at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                  at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                  at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:326) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                  at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:244) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                  at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                  at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                  at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                  at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]

                        Caused by: javax.jms.IllegalStateException: Non XA connection

                                  at org.hornetq.ra.HornetQRASession.getSession(HornetQRASession.java:1246)

                                  at org.hornetq.ra.HornetQRAMessage.acknowledge(HornetQRAMessage.java:71)

                                  at model.logic.CompanyMDP.onMessage(CompanyMDP.java:13) [classes:]

                                  ... 9 more

                         

                         

                        Still the same. Note that this was to be expected. From the Spring documentation (http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/jms.html)

                        - "When using a PlatformTransactionManager with JmsTemplate, the template will always be given a transactional JMS Session."

                        - "A reference to an external PlatformTransactionManager (typically an XA-based transaction coordinator, e.g. Spring's JtaTransactionManager). If not specified, native acknowledging will be used (see "acknowledge" attribute)"

                        - "To configure a message listener container for XA transaction participation, you'll want to configure a JtaTransactionManager (which, by default, delegates to the Java EE server's transaction subsystem). Note that the underlying JMS ConnectionFactory needs to be XA-capable and properly registered with your JTA transaction coordinator!"

                         

                        Note in the Spring configuration above that the org.springframework.transaction.jta.JtaTransactionManager is used.

                        • 9. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                          Justin Bertram Master

                          Can you turn TRACE logging on for org.hornet.ra, reproduce the exception, and then attach the log or provide a really simple test-case we could use to reproduce this?

                          • 10. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                            renevanwijk Newbie

                            The test case is limited to just JMS (no database as in the original), with the same result:

                             

                            08:48:25,793 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "Test.war"

                            08:48:25,856 INFO  [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /Test

                            08:48:26,169 INFO  [org.jboss.as.server] (host-controller-connection-threads - 4) JBAS018559: Deployed "Test.war"

                            08:48:54,123 INFO  [org.jboss.modcluster.ModClusterService] (MSC service thread 1-2) All active sessions drained from context [/SpringHibernate] in 0 seconds

                            08:48:54,181 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment SpringHibernate.war in 133ms

                            08:48:54,209 INFO  [org.jboss.as.repository] (host-controller-connection-threads - 4) JBAS014901: Content removed from location /home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server1/data/content/79/3514d533c4961d477437e0cfe1ac9d0831d619/content

                            08:48:54,210 INFO  [org.jboss.as.server] (host-controller-connection-threads - 4) JBAS018558: Undeployed "SpringHibernate.war"

                            08:49:44,774 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp-axis-into-ict.nl-192.168.1.150-9080-6) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@707561aa: startup date [Tue Aug 21 08:49:44 CEST 2012]; root of context hierarchy

                            08:49:44,833 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp-axis-into-ict.nl-192.168.1.150-9080-6) Loading XML bean definitions from class path resource [spring-config.xml]

                            08:49:45,208 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp-axis-into-ict.nl-192.168.1.150-9080-6) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@63292d35: defining beans [company,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,connectionfactory,destination,jmstemplate,companymdp,org.springframework.jms.listener.DefaultMessageListenerContainer#0]; root of factory hierarchy

                            08:49:45,341 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9080-6) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@64368400

                            08:49:45,342 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9080-6) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@229ff6d1

                            08:49:45,343 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9080-6) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@5f3c750c

                            08:49:45,491 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (ajp-axis-into-ict.nl-192.168.1.150-9080-6) Starting beans in phase 2147483647

                            08:49:45,509 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9080-6) INSERT 16g3re1kvo0wq 9058

                            08:49:45,662 WARN  [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) Execution of JMS message listener failed, and no ErrorHandler has been set.: java.lang.RuntimeException: javax.jms.IllegalStateException: Non XA connection

                                      at model.logic.CompanyMDP.onMessage(CompanyMDP.java:16) [classes:]

                                      at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                      at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                      at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:326) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:244) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]

                                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]

                            Caused by: javax.jms.IllegalStateException: Non XA connection

                                      at org.hornetq.ra.HornetQRASession.getSession(HornetQRASession.java:1246)

                                      at org.hornetq.ra.HornetQRAMessage.acknowledge(HornetQRAMessage.java:71)

                                      at model.logic.CompanyMDP.onMessage(CompanyMDP.java:13) [classes:]

                                      ... 9 more

                             

                             

                            I have uploaded the server configuration and the application (source) to Dropbox and can be found here: https://www.dropbox.com/sh/f5orcs55g7j57oj/nX6lc2HDXy/Test

                             

                            The application (Test.zip) is build using IntelliJ, so you probably have copy and paste the sources (present in the src directory) to the IDE you are using.

                            Also contained in the application is a lib directory that contains the Spring jars (and a javaee6.jar for JMS and Servlet).

                             

                            The server configuration (apache.zip and jboss-as-7.1.0.Final.zip), contains the domain.xml and host.xml; it also contains the module definition used for the spring framework (in the

                            application this module is referenced by using jboss-deployment-structure.xml).

                             

                            The server is fronted by apache with a mod_cluster configuration. We have the following directory structure:

                            /apache

                                 /conf

                                      httpd.conf

                                      mod_cluster.conf

                                 /modules

                                      the modules needed for mod_cluster

                            /jboss-as-7.1.0.Final

                                 /deploy/test/Test.war (the application)

                                  /domain

                                      /configuration

                                           domain.xml

                                           host.xml

                                 /modules

                                      /org/springframework

                                           - necessary jars for Spring

                                           module.xml

                                 /scripts (contains start and stop scripts for the environment - we you want to use these you probably have to edit the *.cli files

                             

                            By using the command-line utitlity you can deploy the application as follows:

                            - deploy /home/jboss/jboss-as-7.1.0.Final/deploy/test/Test.war --server-groups=cluster-group

                             

                            The enironment runs on 64 bits Linux and the Java version used is jdk1.6.0_31 (also 64 bit)

                             

                            If you need any more files (or other info) just let me know.

                            • 11. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                              Andy Taylor Master

                              Can you provide something simple for us to test, I see you are using Apache and that is something I don't have on my machine, also you havent given any hint as how to run it

                               

                              basically a zip we can expand and run, we are all quite busy on the next release and dont really have time to be setting up environments, bassically something so we can:

                               

                              export JBOSS_HOME=...

                              ./build.sh

                              ./deploy.sh

                              ./run.sh

                              • 12. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                                renevanwijk Newbie

                                You can leave out Apache, and use, for example, a standalone configuration that comes with a JBoss distribution.

                                Note that you will need the standalonefull.xml configuration as messaging is required.

                                (JBoss can be downloaded here http://www.jboss.org/as7 you also need a JDK to run)

                                 

                                <jee:jndi-lookup id="connectionfactory" jndi-name="java:/JmsXA" resource-ref="false"/>

                                <jee:jndi-lookup id="destination" jndi-name="java:/queue/test" resource-ref="false"/>

                                 

                                Note that the connection factory has a JNDI name of 'java:/JmsXA' - still to my knowledge is configured by default.

                                The queue has a JNDI name of 'java:/queue/test' (not sure is configured by default).

                                 

                                The jboss-as-7.1.0.Final.zip (in Dropbox) has a .war that can be deployed - you have to make sure the modules

                                in JBoss contain the org/springframe (contained in the zip as well).

                                 

                                When the application is deployed it can be reached at: http://hostname:port/contextroot/testservlet (note that the testservlet shows a blank

                                page - everything is written to the log file). To deploy the application you can use the JBoss console (http://hostname:9990).

                                • 13. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                                  Andy Taylor Master

                                  Im pretty busy, can you write me a script that i can run that will create the config and deploy the war, if you do I will take a look.

                                  • 14. Re: JBoss AS7 HornetQ (XA, Spring, Hibernate)
                                    renevanwijk Newbie

                                    Are you kidding. How easy can it get: unzip a JBoss distribution, install a JDK

                                    run standalone.sh, copy the module, open the console and deploy the war.

                                    1 2 Previous Next