When using Aries transaction manager XA transaction it raises IllegalStateException

Solution Verified - Updated -

Issue

Usecase is a Camel route running inside ServiceMix that routes messages from one broker to another using XA transactions. The Aries transaction manager is leveraged and is also configured to persist its transaction log to the file system. The necessary configuration in SMX_HOME/etc/org.apache.aries.transaction.cfg has been set to include

aries.transaction.timeout=600
aries.transaction.howl.logFileDir=${karaf.data}/txlog/
aries.transaction.recoverable=true

so that a recoverable transaction log is being written to the data/txlog folder.

Further the camel-jms endpoint configuration uses the XA aware ActiveMQ XaPooledConnectionFactory, similar to this configuration

<reference id="ariesTxManager" interface="javax.transaction.TransactionManager" availability="mandatory" />

<bean id="activemqxa" class="org.apache.camel.component.jms.JmsComponent">
  <property name="configuration" ref="XAJmsConfig" />
</bean>

<bean id="XAJmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
  <property name="connectionFactory" ref="XAPooledCF" />
  <property name="transacted" value="false" />
  <property name="transactionManager" ref="platformTxManager" />
  <property name="maxConcurrentConsumers" value="1" />
  <property name="cacheLevelName" value="CACHE_NONE" />
</bean>

<bean id="XAPooledCF" class="org.apache.activemq.pool.XaPooledConnectionFactory">
  <property name="maxConnections" value="1" />
  <property name="connectionFactory" ref="AmqXaCF" />
  <property name="transactionManager" ref="ariesTxManager" />
</bean>

<bean id="AmqXaCF" class="org.apache.activemq.ActiveMQXAConnectionFactory">
  <property name="brokerURL" value="failover:(tcp://localhost:61616)" /> 
  <property name="redeliveryPolicy" ref="redeliveryPolicy" />
</bean>

However with the Aries recoverable transaction log enabled it now raises the following error for every transaction to be committed:

09:36:53,109 | ERROR | Consumer[ESB_IN] | Transaction                      | 51 - org.apache.aries.transaction.manager - 0.3.1.fuse-SNAPSHOT | Please correct the integration and supply a NamedXAResource
java.lang.IllegalStateException: Cannot log transactions as TransactionContext{transactionId=null} is not a NamedXAResource.
    at org.apache.geronimo.transaction.manager.TransactionImpl$TransactionBranch.getResourceName(TransactionImpl.java:761)
    at org.apache.geronimo.transaction.log.HOWLLog.prepare(HOWLLog.java:253)
    at org.apache.geronimo.transaction.manager.TransactionImpl.internalPrepare(TransactionImpl.java:460)
    at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:306)
    at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252)
    at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1009)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
    at org.apache.aries.transaction.GeronimoPlatformTransactionManager.commit(GeronimoPlatformTransactionManager.java:76)
    at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_29]
    at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_29]
    at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50)[8:org.apache.aries.proxy:0.3.0]
    at org.apache.aries.proxy.impl.DefaultWrapper.invoke(DefaultWrapper.java:31)[8:org.apache.aries.proxy:0.3.0]
    at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:78)[8:org.apache.aries.proxy:0.3.0]
    at $Proxy73.commit(Unknown Source)[92:org.springframework.transaction:3.0.5.RELEASE]
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257)[94:org.springframework.jms:3.0.5.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)[94:org.springframework.jms:3.0.5.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)[94:org.springframework.jms:3.0.5.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)[94:org.springframework.jms:3.0.5.RELEASE]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_29]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_29]
    at java.lang.Thread.run(Thread.java:680)[:1.6.0_29]

Environment

  • ServiceMix 4.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In