Enable trace level logging for ActiveMQ
org.apache.activemq.transaction.XATransaction to see when the rollback
is occurring. It seems that it is occurring before the TM attempts it,
possibly as a result of returning to a pool, which would point to a
bug or misconfiguration.

I suspect the 10 threads are the result of transaction completion on
each of the polling requests from the DMLC, it creates a new
session/consumer and will not get any message but will do a rollback.

I made some updates to better support recovery and exactly once
delivery semantics, see:
https://issues.apache.org/jira/browse/AMQ-3305 - to pick these up you
will need to use a 5.6-SNAPSHOT.
The test case uses geronimo from camel, but may provide a working use
case that you can compare and contrast with.

http://svn.apache.org/viewvc/activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXATest.java?view=markup
http://svn.apache.org/viewvc/activemq/trunk/activemq-camel/src/test/resources/org/apache/activemq/camel/jmsXajdbc.xml?view=markup

On 1 June 2011 12:18, James Black <be_st...@yahoo.co.uk> wrote:
> Hello,
>
> The situation is we want to use XA transactions for ActiveMQ and Hibernate
> (Sql Server 2008).
>
> We are using:
>
> Spring 3.0.5
> Hibernate 3.6.2
> ActiveMQ 5.5.0
> Atomikos 3.7
>
> We are seeing the following errors getting generated in the log file related
> to the transaction has not been started.  These are always related to JMS.
>
> Transaction '[ID]' has not been started.
>
> These are getting generated into the logs all the time.
>
> The issue is more complicated in that we have 3 web application that work
> with the same JMS queues and the errors do not seem to be generated when
> only a single web application is running.
>
> These are deployed to separate instances of Tomcat 7.0.14 running on the
> same machine.
>
> When monitoring the web application throwing these errors using VisualVM the
> application was creating 10 new threads per second.  This was without any
> activity through HTTP or on the ActiveMQ queues.
>
> Stack trace:
> 011-05-31 15:04:27,065 [Atomikos:30] WARN  -
> [com.atomikos.diagnostics.Slf4jConsole] : XA resource 'XAJMS': rollback for
> XID
> '3139322E3136382E302E35332E746D30363636333030303031:3139322E3136382E302E35332E746D36363633'
> raised 0: unknown
> javax.transaction.xa.XAException: Transaction
> 'XID:1096044365:3139322e3136382e302e35332e746d30363636333030303031:3139322e3136382e302e35332e746d36363633'
> has not been started.
>        at
> org.apache.activemq.TransactionContext.toXAException(TransactionContext.java:732)
>        at
> org.apache.activemq.TransactionContext.rollback(TransactionContext.java:497)
>        at
> com.atomikos.datasource.xa.XAResourceTransaction.rollback(XAResourceTransaction.java:690)
>        at 
> com.atomikos.icatch.imp.RollbackMessage.send(RollbackMessage.java:72)
>        at
> com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:111)
>        at
> com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:87)
>        at
> com.atomikos.icatch.imp.Propagator.submitPropagationMessage(Propagator.java:66)
>        at
> com.atomikos.icatch.imp.HeurHazardStateHandler.onTimeout(HeurHazardStateHandler.java:124)
>        at 
> com.atomikos.icatch.imp.CoordinatorImp.alarm(CoordinatorImp.java:1105)
>        at
> com.atomikos.timing.PooledAlarmTimer.notifyListeners(PooledAlarmTimer.java:112)
>        at com.atomikos.timing.PooledAlarmTimer.run(PooledAlarmTimer.java:99)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:662)
> Caused by: javax.transaction.xa.XAException: Transaction
> 'XID:1096044365:3139322e3136382e302e35332e746d30363636333030303031:3139322e3136382e302e35332e746d36363633'
> has not been started.
>        at
> org.apache.activemq.broker.TransactionBroker.getTransaction(TransactionBroker.java:290)
>        at
> org.apache.activemq.broker.TransactionBroker.rollbackTransaction(TransactionBroker.java:177)
>        at
> org.apache.activemq.broker.MutableBrokerFilter.rollbackTransaction(MutableBrokerFilter.java:131)
>        at
> org.apache.activemq.broker.TransportConnection.processRollbackTransaction(TransportConnection.java:436)
>        at
> org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:104)
>        at
> org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:306)
>        at
> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:179)
>        at
> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69)
>        at
> org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
>        at
> org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:227)
>        at
> org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
>        at
> org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:220)
>        at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:202)
>        at java.lang.Thread.run(Unknown Source)
>
> Our Spring configuration:
>
> JNDI Connection Factory for ActiveMQ
>
> <Resource name="jms/ConnectionFactory"
>              auth="Container"
>              type="org.apache.activemq.ActiveMQXAConnectionFactory"
>              description="JMS XA Connection Factory"
>              factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>
> brokerURL="tcp://${activemq.server.name}:${activemq.server.port}"
>              brokerName="LocalActiveMQBroker" />
>
>
> <bean id="atomikosConnectionFactory"
>          class="com.atomikos.jms.AtomikosConnectionFactoryBean"
>          init-method="init" destroy-method="close">
>        <property name="uniqueResourceName" value="XAJMS" />
>        <property name="xaConnectionFactory" ref="jmsConnectionFactory" />
>        <property name="maxPoolSize" value="40" />
>    </bean>
>
> <bean id="getSomeStuffListenerAdapter"
>
> class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
>        <property name="delegate" ref="targetElement" />
>        <property name="defaultListenerMethod" value="doStuff" />
>        <property name="messageConverter" ref="myMessageConverter" />
> </bean>
>
> <bean id="getSomeStuffListenerContainer"
>
> class="org.springframework.jms.listener.DefaultMessageListenerContainer"
>          depends-on="txManager">
>        <property name="connectionFactory" ref="atomikosConnectionFactory"/>
>        <property name="destination" ref="jmsQueue01"/>
>        <property name="messageListener" ref="getSomeStuffListenerAdapter"
> />
>        <property name="concurrency" value="5-10" />
>        <property name="transactionManager" ref="txManager" />
>        <property name="sessionTransacted" value="true" />
>    </bean>
>
> <bean id="atomikosTransactionManager"
>          class="com.atomikos.icatch.jta.UserTransactionManager"
>          depends-on="dataSource, atomikosConnectionFactory"
>          init-method="init" destroy-method="close">
>        <property name="forceShutdown" value="false" />
>    </bean>
>
> <bean id="txManager"
>          class="org.springframework.transaction.jta.JtaTransactionManager">
>        <property name="transactionManager" ref="atomikosTransactionManager"
> />
>    </bean>
>
> Any help much appreciated?
>
> James
>
> --
> View this message in context: 
> http://activemq.2283324.n4.nabble.com/Transaction-not-started-XA-problems-tp3565540p3565540.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
http://fusesource.com
http://blog.garytully.com

Reply via email to