I have been working on a similar issue recently which we cannot get our head around. Using this thread and http://tomee-openejb.979440.n4.nabble.com/MDB-doesn-t-read-messages-td4666169.html we have been able to reliably reproduce the failure within a sample project. I will be trying to get the sample project up on github sometime this weekend.
We were able to get TomEE to start using the ActiveMQXAConnectionFactory but that still resulted in the same problems. We have tried multiple configurations to try and figure this out but nothing has worked. In our sample we are sending messages and saving to a database within a transactional method, our expectation is that both should proceed only after the XA translation is committed but that is not the result we are getting. Currently we are seeing messages sending to the queues _before_ the method completes which should never happen while using XA if the transaction is uncommitted. If we have a listener on the queue which attempts to read the object saved to the database in the producer we get issues. Specifically, the previous XA transaction has yet to close so the database writes are not committed and therefore unavailable to be read within the subsequent listener. More detail here http://stackoverflow.com/questions/27325977/spring-tomee-jta-transactions from a coworker but including some configuration below for this chain. Any ideas as to what could be going wrong here? tomee.xml: <Resource id="TomEEJmsResourceAdapter" type="ActiveMQResourceAdapter"> BrokerXmlConfig = broker:(vm://localhost) ServerUrl = vm://localhost </Resource> <Resource id="resources/jms/XAConnectionFactory" class-name="org.apache.activemq.ActiveMQXAConnectionFactory"> ResourceAdapter = TomEEJmsResourceAdapter </Resource> <Resource id="PrintQueue" type="javax.jms.Queue"/> <Resource id="MySQL Database" type="DataSource"> JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlXADataSource JdbcUrl jdbc:mysql://localhost/test UserName test </Resource> Spring config: <bean id="printQueue" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory"> <ref local="jmsFactory" /> </property> <property name="defaultDestinationName" value="printQueue" /> <property name="deliveryPersistent" value="true"/> <!-- <property name="sessionTransacted" value="true"/> --> <property name="explicitQosEnabled" value="true"/> </bean> <jms:listener-container container-type="default" connection-factory="jmsFactory" cache="none" acknowledge="transacted" transaction-manager="transactionManager" concurrency="1" > <jms:listener destination="printQueue" ref="printListener"/> </jms:listener-container> Trevor Stevens [email protected] > On Dec 2, 2014, at 7:40 AM, Romain Manni-Bucau <[email protected]> wrote: > > I have to admit I never used this one but here some randoms thoughts: > 1) packaging/binaries: try putting spring + AMQ in tomee/lib and check > you still have the issue > 1bis) ensure you don't deliver APIs which could conflicts with tomee > (jms and jta ones for instance) > 2) init in a wrong context > > > > Romain Manni-Bucau > @rmannibucau > http://www.tomitribe.com > http://rmannibucau.wordpress.com > https://github.com/rmannibucau > > > 2014-12-02 13:25 GMT+01:00 drieselliott <[email protected]>: >> Hi, >> >> When I switch to an ActiveMQXAConnectionFactory TomEE crashes. The >> ConnectionFactory is possibly causing the strange behaviour we are >> encountering. >> >> Do you have any ideas why TomEE can't start when I define this resource? >> >> Kind regards, >> >> Dries >> >> >> >> -- >> View this message in context: >> http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673106.html >> Sent from the TomEE Users mailing list archive at Nabble.com.
