Om P
Om P

Reputation: 117

Setup of JMS message listener invoker failed for destination 'queue:XYZ:No JTA UserTransaction available

We are upgrading our project from Spring 2.5.6 to 3.2.3 and Hibernate/JPA to 4.2.3.

In spring-ds.xml for transaction management we replaced original below config

<bean id="transactionManager"
            class="org.springframework.transaction.jta.WebSphereUowTransactionManager">
            <!-- This property is specifically required for JMS -->
            <property name="transactionManager" ref="baseTransactionManager" />
      </bean>

      <bean id="baseTransactionManager"
            class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean" />
      <tx:annotation-driven transaction-manager="transactionManager" />

to below as WebSphereTransactionManagerFactoryBean class is superseded in latest WAS :

<bean id="transactionManager"
class="org.springframework.transaction.jta.WebSphereUowTransactionManager" />

and JMS msg listener config looks like below :

<bean id="xxtMsgListenerContainer"
        class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="jmsxxConnectionFactory" />
        <property name="destination" ref="jmsxxQueue" />
        <property name="messageListener" ref="xxMessageListener" />
        <property name="transactionManager" ref="transactionManager" />
        <property name="taskExecutor" ref="taskExecutor" />

    </bean>

With above config we are getting below error in WAS logs :

Setup of JMS message listener invoker failed for destination queue://xxQueue?busName=zzBus' - trying to recover. Cause: No JTA UserTransactionavailable - programmatic PlatformTransactionManager.getTransaction usage not supported

Is there any other config/property required to upgrade to spring 3.2.3 ? or to config WebSphereUowTransactionManager do we need to set any property ?

Upvotes: 0

Views: 5262

Answers (3)

Talijanac
Talijanac

Reputation: 1157

The error happens because you have used JTA transaction manager, while your connection factory is not XA capable. Essentially injected implementation of ConnectionFactory does not implement JTA interfaces. Thus transaction manager isn't able of enrolling a message consumption into a new instance of UserTransaction.

In other to fix this issues the one needs to use XA capable ConnectionFactory, or other non-jta transaction manager like Spring's JmsTransactionManager.

Upvotes: 0

Puneetsri
Puneetsri

Reputation: 254

In case you are using Hibernate in your application, the actual Hibernate version used can be the root cause of the problem.

We spent half a day debugging it (on a WebSphere box), and then found that indeed it was the hibernate version upgrade (from 4.2.7.Final to 4.2.12.Final) which caused issue, not the JMS configuration.

UPDATE: It seems that Hibernate includes transaction-api jboss-transaction-api_1.1_spec which was not compatible with the one present on Websphere. Simply excluding this from hibernate resolved the issue.

Upvotes: 2

incomplete-co.de
incomplete-co.de

Reputation: 2137

on the DefaultMessageListenerContainer, try setting the sessionTransacted property to true. this should enable transaction support with WebSphere

Upvotes: 0

Related Questions