Wow makes a lot for a single night. Let's try to explain my changes then: - if you are not transacted when you create the session then you dont participate to the rollback as expected. - the config you dis with class-name was not using jta so same result as previous point - this is why the ra is needed
The overall point is: bitronix config was/is not 1-1 with the one you do in tomee + the biteonix wrapper makes amq behaving differently. Not a transacted session means you try to use jta on a session created with transacted=false bit a xa connection factory. Side note: you can use bitronix in tomee if you find the ra usage overkill or too hard. Le 6 nov. 2015 04:54, "iannuz" <[email protected]> a écrit : > Hi again, > > I have modified the test app in github so that now it runs *two concurrent > activemq instances* in place of one.. which is the final scenario. > > With that scenario (where XA is really necessary) JVM+Bitronix keeps > behaving ok *while tomee doesn't, even after applying your patch with some > changes done in order to have two resource adapters*. > > I wasn't able to create the patch in GitHub as you did so I paste it here: > --------------------------------------------------------------- > diff --git > a/TestXA-allEmbedded/src/main/java/com/test/MyMessageReceiver.java > b/TestXA-allEmbedded/src/main/java/com/test/MyMessageReceiver.java > index 6992395..e89cf4b 100644 > --- a/TestXA-allEmbedded/src/main/java/com/test/MyMessageReceiver.java > +++ b/TestXA-allEmbedded/src/main/java/com/test/MyMessageReceiver.java > @@ -111,7 +111,7 @@ > Session session = null; > try { > conn = forwardConnectionFactory.createConnection(); > - session = conn.createSession(false, > Session.AUTO_ACKNOWLEDGE); > + session = conn.createSession(true, > Session.AUTO_ACKNOWLEDGE); > MessageProducer messageProducer = > session.createProducer(forwardQueue); > TextMessage msg = > session.createTextMessage(msgToBeSent); > messageProducer.send(msg); > diff --git a/TestXA-allEmbedded/tomee/conf/tomee.xml > b/TestXA-allEmbedded/tomee/conf/tomee.xml > index 65a6910..1126d53 100644 > --- a/TestXA-allEmbedded/tomee/conf/tomee.xml > +++ b/TestXA-allEmbedded/tomee/conf/tomee.xml > @@ -1,62 +1,65 @@ > <?xml version="1.0" encoding="UTF-8"?> > <tomee> > - > - <Resource id="MyAdapter" type="ActiveMQResourceAdapter"> > - BrokerXmlConfig > - ServerUrl tcp://fakehost:666 > - </Resource> > + <Resource id="BrokerIn" type="ActiveMQResourceAdapter"> > + BrokerXmlConfig = > + ServerUrl = > tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=0 > + </Resource> > > - <Resource id="jms/MyIncomingConnFactory" > type="javax.jms.ConnectionFactory" > class-name="org.apache.activemq.ActiveMQXAConnectionFactory"> > - BrokerURL > tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=0 > - </Resource> > - > - <Resource id="jms/MyOutgoingConnFactory" > type="javax.jms.ConnectionFactory" > class-name="org.apache.activemq.ActiveMQXAConnectionFactory"> > - BrokerURL > tcp://localhost:61617?jms.redeliveryPolicy.maximumRedeliveries=0 > - </Resource> > - > - <Resource id="jms/MyOutgoingQueue" > class-name="org.apache.activemq.command.ActiveMQQueue"> > - PhysicalName MY_OUTGOING_QUEUE > - </Resource> > - > - <Resource id="jms/MyIncomingQueue" > class-name="org.apache.activemq.command.ActiveMQQueue"> > - PhysicalName MY_INCOMING_QUEUE > - </Resource> > + <Resource id="BrokerOut" type="ActiveMQResourceAdapter"> > + BrokerXmlConfig = > + ServerUrl = > tcp://localhost:61617?jms.redeliveryPolicy.maximumRedeliveries=0 > + </Resource> > > - > - > - > - <Resource id="jdbc/myDBXAPooled" type="DataSource"> > - XaDataSource myDBXA > - DataSourceCreator dbcp > - JtaManaged true > - UserName none > - Password none > - MaxWait 2000 > - ValidationQuery SELECT 1 FROM SYSIBM.SYSDUMMY1 > - MaxActive 15 > - </Resource> > - <Resource id="myDBXA" type="XADataSource" > class-name="org.apache.derby.jdbc.ClientXADataSource"> > - DatabaseName xaTestDB > - ServerName localhost > - PortNumber 1527 > - User none > - Password none > - </Resource> > - > + <Resource id="jms/MyIncomingConnFactory" > type="javax.jms.ConnectionFactory"> > + ResourceAdapter = BrokerIn > + </Resource> > + <Resource id="jms/MyOutgoingConnFactory" > type="javax.jms.ConnectionFactory"> > + ResourceAdapter = BrokerOut > + </Resource> > + > + <Resource id="jms/MyOutgoingQueue" type="javax.jms.Queue"> > + PhysicalName = MY_OUTGOING_QUEUE > + </Resource> > + > + <Resource id="jms/MyIncomingQueue" type="javax.jms.Queue"> > + PhysicalName = MY_INCOMING_QUEUE > + </Resource> > + > + > + > + > + <Resource id="jdbc/myDBXAPooled" type="DataSource"> > + XaDataSource myDBXA > + DataSourceCreator dbcp > + JtaManaged true > + UserName none > + Password none > + MaxWait 2000 > + ValidationQuery SELECT 1 FROM SYSIBM.SYSDUMMY1 > + MaxActive 15 > + </Resource> > + <Resource id="myDBXA" type="XADataSource" > class-name="org.apache.derby.jdbc.ClientXADataSource"> > + DatabaseName xaTestDB > + ServerName localhost > + PortNumber 1527 > + User none > + Password none > + </Resource> > + > </tomee> > --------------------------------------------------------------- > > Also in this case, with your patch applied, I keep getting when in tomee: > ---------------------------------- > ... > 13:50:13,489 INFO msgListenersTaskExecutor-1 com.test.MyListener:921 - > Successfully refreshed JMS Connection > 13:50:19,495 WARN msgListenersTaskExecutor-1 com.test.MyListener:871 - > Setup of JMS message listener invoker failed for destination > 'queue://MY_INCOMING_QUEUE' - trying to recover. Cause: Local JMS > transaction failed to commit; nested exception is javax.j > ms.IllegalStateException: Not a transacted session > 13:50:19,496 INFO msgListenersTaskExecutor-1 com.test.MyListener:921 - > Successfully refreshed JMS Connection > 13:50:25,506 WARN msgListenersTaskExecutor-1 com.test.MyListener:871 - > Setup of JMS message listener invoker failed for destination > 'queue://MY_INCOMING_QUEUE' - trying to recover. Cause: Local JMS > transaction failed to commit; nested exception is javax.j > ms.IllegalStateException: Not a transacted session > 13:50:25,506 INFO msgListenersTaskExecutor-1 com.test.MyListener:921 - > Successfully refreshed JMS Connection > 13:50:31,512 WARN msgListenersTaskExecutor-1 com.test.MyListener:871 - > Setup of JMS message listener invoker failed for destination > 'queue://MY_INCOMING_QUEUE' - trying to recover. Cause: Local JMS > transaction failed to commit; nested exception is javax.j > ms.IllegalStateException: Not a transacted session > 13:50:31,512 INFO msgListenersTaskExecutor-1 com.test.MyListener:921 - > Successfully refreshed JMS Connection > 13:50:37,523 WARN msgListenersTaskExecutor-1 com.test.MyListener:871 - > Setup of JMS message listener invoker failed for destination > 'queue://MY_INCOMING_QUEUE' - trying to recover. Cause: Local JMS > transaction failed to commit; nested exception is javax.j > ms.IllegalStateException: Not a transacted session > 13:50:37,523 INFO msgListenersTaskExecutor-1 com.test.MyListener:921 - > Successfully refreshed JMS Connection > 13:50:43,534 WARN msgListenersTaskExecutor-1 com.test.MyListener:871 - > Setup of JMS message listener invoker failed for destination > 'queue://MY_INCOMING_QUEUE' - trying to recover. Cause: Local JMS > transaction failed to commit; nested exception is javax.j > ms.IllegalStateException: Not a transacted session > ... > ---------------------------------- > > Pls let me know your thoughts. > > > > -- > View this message in context: > http://tomee-openejb.979440.n4.nabble.com/Tomee-MySql-ActiveMQ-XA-Distributed-Transactions-tp4676680p4676746.html > Sent from the TomEE Users mailing list archive at Nabble.com. >
