1
votes

I have a spring JTA transaction manager configured for Bitronix running on Tomcat 7. The transaction manager starts properly and the application works fine. I however get a lot of debug messages stating that

No JTA TransactionManager found at fallback JNDI location [java:comp/TransactionManager] No JTA TransactionManager found at fallback JNDI location [java:pm/TransactionManager] No JTA TransactionManager found at fallback JNDI location [java:appserver/TransactionManager]

etc..

I understand that this is the JtaTransactionManager scanning known jndi locations and this is not an error but a debug exception. The following is my transaction manager configuration

<bean id="BitronixTransactionManager" factory-method="getTransactionManager" class="bitronix.tm.TransactionManagerServices" 
     destroy-method="shutdown" /> 

and the jta transaction manager

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="autodetectTransactionManager" value="false"/>
<property name="transactionManager" ref="BitronixTransactionManager" />    
<property name="userTransaction" ref="BitronixTransactionManager" />

I thought that setting the autodetectTransactionManager value to false would prevent this scanning and the resulting debug exceptions but it seems this setting has no effect.

I also tried with the following properties for the transactionManager to set the jndi location.

<property name="transactionManagerName" value="java:comp/TransactionManager"/>
<property name="userTransactionName" value="java:comp/UserTransaction"/> 

I am using jta 1.1 and also get the same lookup message for the TransactionSynchronizationRegistry:

DEBUG [main] JtaTransactionManager.findTransactionSynchronizationRegistry(146) | No JTA TransactionSynchronizationRegistry found at default JNDI location [java:comp/TransactionSynchronizationRegistry]

I would really like to understand this and not merely filter this out with my Log4J

1

1 Answers

0
votes

Probably the problem is that in Tomcat the default jndi locations are in in java:comp/env. So you should do

<property name="transactionManagerName" value="java:comp/env/TransactionManager"/>
<property name="transactionSynchronizationRegistryName" value="java:comp/env/TransactionSynchronizationRegistry"/>
<property name="userTransactionName" value="java:comp/env/UserTransaction"/>