I am trying to configure bitronix as my JTA manager with spring like this:
<!-- Bitronix Transaction Manager embedded configuration -->
<bean id="xaDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource"
init-method="init" destroy-method="close">
<property name="className" value="bitronix.tm.resource.jdbc.lrc.LrcXADataSource" />
<property name="uniqueName" value="java/DS1" />
<property name="maxPoolSize" value="5" />
<property name="minPoolSize" value="0" />
<property name="allowLocalTransactions" value="false" />
<property name="testQuery" value="SELECT 1 FROM DUAL" />
<property name="driverProperties">
<props>
<prop key="user">user</prop>
<prop key="password">user</prop>
<prop key="url">url</prop>
<prop key="driverClassName">oracle.jdbc.OracleDriver</prop>
</props>
</property>
</bean>
<bean id="btmConfig" factory-method="getConfiguration"
class="bitronix.tm.TransactionManagerServices">
<property name="serverId" value="spring-btm" />
</bean>
<bean id="bitronixTransactionManager" factory-method="getTransactionManager"
class="bitronix.tm.TransactionManagerServices" depends-on="btmConfig,xaDataSource"
destroy-method="shutdown" />
<bean id="jtaTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="bitronixTransactionManager" />
<property name="userTransaction" ref="bitronixTransactionManager" />
</bean>
<!-- end of Bitronix Transaction Manager embedded configuration -->
I see that bitronix is starting and running:
399 DEBUG ( PoolingDataSource.java:84) - building XA pool for java/DS1 with 0 connection(s) etc..)
However when I try:
DataSource ds = (DataSource) ic.lookup("java:comp/UserTransaction");
I get naming exception for it.
WHy is it? what else do I need to configure?
EDITED
I saw in tomcat documentation that the <Transaction> can bound the transaction manager to take care of it.
wouldn't it be a conflict that I define it both in tomcat and in spring?