Saturday, April 26, 2014

Resolve TransactionManager lookup fails on JBoss EAP 6 (AS7): No JTA TransactionManager found at fallback JNDI location (NameNotFoundException)

Using JBoss EAP 6.2, I have an application running on it. I needed to exclude the JBoss Logging as explained in this link.
So adding the exclusion in the jboss-deployment-structure.xml I have errors.

 javax.naming.NameNotFoundException: TransactionManager -- service jboss.naming.context.java.module.myprojectname.TransactionManager
org.springframework.transaction.jta.JtaTransactionManager] No JTA TransactionManager found at fallback JNDI location [java:appserver/TransactionManager]
 javax.naming.NameNotFoundException: java:appserver/TransactionManager
javax.naming.NameNotFoundException: java:pm/TransactionManager

Oh oOh what happens. Ayyy. Jboss is angry because I have excluded its logging :|. Ok I will not use the Jboss logging even if it is not happy for that.
So now I need to fix the jndi lookup of the jboss transaction manager. If you look in Standalone.xml, you will not find this jndi name. Strange no !! In fact by default it is java:jboss/TransactionManager.

So all what I need now is to specify to Spring the name of my Transaction Manager. So first, I have removed the old declaration :


<tx:jta-transaction-manager/>

And I substitute it by : 


1
2
3
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
       <property name="transactionManagerName" value="java:jboss/TransactionManager"/>
</bean>

And now every think is working and I can see in the log while deploying :

DEBUG org.springframework.transaction.jta.JtaTransactionManager  - Retrieving JTA TransactionManager from JNDI location [java:jboss/TransactionManager]

1 comment :

  1. This comment has been removed by a blog administrator.

    ReplyDelete

Articles les plus consultés