Atomikos Forum |
|
Hi,
I am trying to configure atomikos distributed transaction using Spring and JNDI. When the AtomikosDataSourceBean is configured as a spring bean, the transaction works as expected (rolling back on any exception). But when i obtain the datasource through JNDI lookup the transaction does not roll back even if there is any exception. IT commits as soon as any statement is executed. Is there any good documentation for Atomikos JNDI Configuration? I referred http://www.atomikos.org/Documentation/Tomcat6Integration33 and cofigured as mentioned. Spring bean configuration: <bean id="jtaDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close" lazy-init="false" > <property name="uniqueResourceName" value="jtaDataSource" /> <property name="xaDataSourceClassName" value="oracle.jdbc.xa.client.OracleXADataSource" /> <property name="xaProperties"> <props> <prop key="URL">${someurl}</prop> <prop key="user">${someusername}</prop> <prop key="password">${somepassword}</prop> </props> </property> <property name="maxPoolSize" value="50" /> <property name="borrowConnectionTimeout" value="30000" /> <property name="testQuery" value="select 1 from dual" /> </bean> JNDI lookup: <bean id="jtaDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" scope="singleton"> <property name="jndiName"> <value>DataSourceJTA</value> </property> <property name="resourceRef" value="true"/> </bean> JNDI resource: <Resource name="DataSourceJTA" auth="Container" type="com.atomikos.jdbc.AtomikosDataSourceBean" factory="com.atomikos.tomcat.BeanFactory" uniqueResourceName="DataSourceJTA" xaDataSourceClassName="oracle.jdbc.xa.client.OracleXADataSource" xaProperties.user="sysadm" xaProperties.password="sysadm" xaProperties.URL="someURL" maxPoolSize ="50" borrowConnectionTimeout="30000" testQuery="select 1 from dual" /> Transaction Manager 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> |