Announcement Announcement Module
No announcement yet.
JMS, XA Transaction not start error Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMS, XA Transaction not start error

    The situation is we want to use XA transactions for ActiveMQ and Hibernate (Sql Server 2008).

    ActiveMQ uses its own internal persistence we are not using Sql Server for that. We just want to coordinate our transactions between ActiveMQ and Sql Server.

    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 '3139322E3136382E302E35332E746D3036363633303030303 1:3139322E3136382E302E35332E746D36363633' raised 0: unknown
    javax.transaction.xa.XAException: Transaction 'XID:1096044365:3139322e3136382e302e35332e746d3036 3636333030303031:3139322e3136382e302e35332e746d363 63633' has not been started.
    at org.apache.activemq.TransactionContext.toXAExcepti on(
    at org.apache.activemq.TransactionContext.rollback(Tr
    at com.atomikos.datasource.xa.XAResourceTransaction.r ollback(
    at com.atomikos.icatch.imp.RollbackMessage.send(Rollb
    at com.atomikos.icatch.imp.PropagationMessage.submit(
    at com.atomikos.icatch.imp.Propagator$PropagatorThrea
    at com.atomikos.icatch.imp.Propagator.submitPropagati onMessage(
    at com.atomikos.icatch.imp.HeurHazardStateHandler.onT imeout(
    at com.atomikos.icatch.imp.CoordinatorImp.alarm(Coord
    at com.atomikos.timing.PooledAlarmTimer.notifyListene rs(
    at java.util.concurrent.ThreadPoolExecutor$ Task(
    at java.util.concurrent.ThreadPoolExecutor$ (
    Caused by: javax.transaction.xa.XAException: Transaction 'XID:1096044365:3139322e3136382e302e35332e746d3036 3636333030303031:3139322e3136382e302e35332e746d363 63633' has not been started.
    at ansaction(
    at ackTransaction(
    at lbackTransaction(
    at cessRollbackTransaction( 36)
    at org.apache.activemq.command.TransactionInfo.visit(
    at vice(
    at$1.o nCommand(
    at org.apache.activemq.transport.TransportFilter.onCo mmand(
    at org.apache.activemq.transport.WireFormatNegotiator .onCommand(
    at org.apache.activemq.transport.InactivityMonitor.on Command(
    at org.apache.activemq.transport.TransportSupport.doC onsume(
    at org.apache.activemq.transport.tcp.TcpTransport.doR un(
    at (
    at Source)

    Our Spring configuration:

    JNDI Connection Factory for ActiveMQ

    <Resource name="jms/ConnectionFactory"
    type="org.apache.activemq.ActiveMQXAConnectionFact ory"
    description="JMS XA Connection Factory"
    factory="org.apache.activemq.jndi.JNDIReferenceFac tory"
    brokerName="LocalActiveMQBroker" />

    <bean id="atomikosConnectionFactory"
    class="com.atomikos.jms.AtomikosConnectionFactoryB ean"
    init-method="init" destroy-method="close">
    <property name="uniqueResourceName" value="XAJMS" />
    <property name="xaConnectionFactory" ref="jmsConnectionFactory" />
    <property name="maxPoolSize" value="40" />

    <bean id="getSomeStuffListenerAdapter"
    class="org.springframework.jms.listener.adapter.Me ssageListenerAdapter">
    <property name="delegate" ref="targetElement" />
    <property name="defaultListenerMethod" value="doStuff" />
    <property name="messageConverter" ref="myMessageConverter" />

    <bean id="getSomeStuffListenerContainer"
    class="org.springframework.jms.listener.DefaultMes sageListenerContainer"
    <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 id="atomikosTransactionManager"
    class="com.atomikos.icatch.jta.UserTransactionMana ger"
    depends-on="dataSource, atomikosConnectionFactory"
    init-method="init" destroy-method="close">
    <property name="forceShutdown" value="false" />

    <bean id="txManager"
    class="org.springframework.transaction.jta.JtaTran sactionManager">
    <property name="transactionManager" ref="atomikosTransactionManager" />

  • #2
    We fixed this issue see the discussion here:

    However, we later decided against using Atomikos, Spring, ActiveMQ as the XA transactions were causing a memory leak in ActiveMQ. This leak does not occur with XA disabled. :<