Atomikos Forum

Atomikos transaction not working properly

I am trying to get 2 phase commit using Atomikos + spring + Hibernate in Tomcat7. Here is my spring-config.xml,

<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close">
    <property name="startupTransactionService"><value>true</value></property>
        <property name="forceShutdown"><value>true</value></property>
        <property name="transactionTimeout"><value>600</value></property>
</bean>

<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp" />

<bean id="transactionManager"
    class="org.springframework.transaction.jta.JtaTransactionManager"
    abstract="false" singleton="true" lazy-init="default"
    autowire="default" dependency-check="default">
    <property name="transactionManager"><ref bean="atomikosTransactionManager"/></property>
    <property name="userTransaction"><ref bean="atomikosUserTransaction"/></property>
    <property name="transactionSynchronizationName" value="SYNCHRONIZATION_ON_ACTUAL_TRANSACTION"/>
</bean>

<bean id="DS" class="oracle.jdbc.xa.client.OracleXADataSource" destroy-method="close">
        <property name="connectionCachingEnabled" value="true" />
        <property name="URL">
             <value>url</value>
            </property>
        <property name="user">
             <value>user</value>
            </property>
        <property name="password">
             <value>pass</value>
            </property>
              <property name="connectionProperties">
        <value>
                autoCommit:false
              </value>
          </property>
        <property name="connectionCacheProperties">
              <value>
                MinLimit:20
                MaxLimit:150
                InitialLimit:5
                ConnectionWaitTimeout:10 
                InactivityTimeout:180
                ValidateConnection:false
              </value>
          </property>
    </bean>
    
jta.properties:

com.atomikos.icatch.service=com.atomikos.icatch.standalone.UserTransactionServiceFactory
com.atomikos.icatch.log_base_dir=../work
com.atomikos.icatch.output_dir=../work
com.atomikos.icatch.console_log_level=DEBUG
com.atomikos.icatch.threaded_2pc=false


I am expecting following things to happen within transaction,

1. Commit to database
2. JMS messaging to cache(For other node connected in cluster)

But, this is not happening properly in failure scenario.
When transaction fails at the end, db commit is not getting rollback and JMS message is propagated to other node in cluster.

Please let me know, if I am missing out anything in configuration.

Thanks in Advance.
Lakshmi Send private email
Wednesday, March 23, 2011
 
 
You should not use the XADataSource or XAConnectionFactory directly, but rather our wrappers:

AtomikosDataSourceBean (com.atomikos.jdbc), and
AtomikosConnectionFactoryBean (com.atomikos.jms).

See http://www.atomikos.com/Documentation/ConfiguringJdbc and http://www.atomikos.com/Documentation/ConfiguringJms

HTH
Guy Pardon Send private email
Wednesday, March 23, 2011
 
 
I have tried this. Given below the configuration,

<bean id="DS" class="com.atomikos.jdbc.AtomikosDataSourceBean" destroy-method="close">
    <property name="uniqueResourceName"><value>XA12</value></property>
    <property name="xaDataSourceClassName" value="oracle.jdbc.xa.client.OracleXADataSource" />
    <property name="xaProperties">
        <props>
            <prop key="URL">url</prop>
            <prop key="user">user</prop>
            <prop key="password">pass</prop>
        </props>
    </property>
    <property name="poolSize"><value>20</value></property>
</bean>

For this, getting exception - "javax.naming.NamingException: Another resource already exists with name XA12 - pick a different name".

Please help.
Lakshmi Send private email
Thursday, March 24, 2011
 
 
Please check here:

default82df.html?community.6.377.9

HTH
Guy Pardon Send private email
Thursday, March 24, 2011
 
 

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

Other recent topics Other recent topics