Atomikos Forum

Failed to convert UserTransactionManager to required type

I've seen this question asked a few other times, but I can't find a good answer overall. I've tried following the spring and hibernate integration docs, but still am stuck.

I have tomcat 7 with all the atomikos jars, jta 1.1, my XA driver jars, and a jta.properties file all in the lib folder.

In my server.xml I have added:
<Listener className="com.atomikos.tomcat.AtomikosLifecycleListener" />

plus JNDI resources for my XA resources wrapped in the EnhancedTomcatAtomikosBeanFactory (a IBM MQ queue connection factory and an Oracle data source)

Then I have a simple maven war project with Java 7 where I have added spring 3.2 jars and other libraries (e.g. cxf)

In my war's /META-INF/context.xml I have:
<Transaction factory="com.atomikos.icatch.jta.UserTransactionFactory" />

In my spring config I create beans for my JNDI resources and then create the following 3 beans:

    <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
            init-method="init" destroy-method="close">
        <property name="forceShutdown" value="true"/>
    </bean>
    
    <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
        <property name="transactionTimeout" value="300"/>
    </bean>
    
    <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
        <property name="transactionManager" ref="atomikosTransactionManager"/>
        <property name="userTransaction" ref="atomikosUserTransaction"/>
    </bean>

I have a test web service that sends a message to the queue and saves a record to the database. This setup WORKS 100%.

Then I add hibernate 4.2 jars and spring-orm 3.2 to my pom and the application fails to start with:
IllegalStateException  Cannot convert value of type [com.atomikos.icatch.jta.UserTransactionManager] to required type [javax.transaction.TransactionManager] for property 'transactionManager': no matching editors or conversion strategy found

I've not changed anything else like defining a session factory in my spring config. Just added the dependency.

I can run a maven package and no jta jars are being added to my WEB-INF/lib so I am still using the correct version in my tomcat/lib and there is definitely only one version of the jar there.

Why does adding Hibernate to my classpath change the result of what really amounts to an eventual call to TransactionManager.Class.isAssignableFrom(UserTransactionManager)?

Thanks

John
John McGinn Send private email
Thursday, March 27, 2014
 
 
I solved my own problem, hibernate was pulling in

<exclusion>
<artifactId>jboss-transaction-api_1.1_spec</artifactId>
<groupId>org.jboss.spec.javax.transaction</groupId>
</exclusion>

Didn't recognizse it because I looked over it due to the jboss group ID :/.
John McGinn Send private email
Thursday, March 27, 2014
 
 
Thanks for sharing the solution!
Guy Pardon Send private email
Saturday, March 29, 2014
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics