About

Jadira is the home for Sousan and Chris Pheby's open source projects. These are reusable open source Java modules that provide first class solutions using the most effective current JEE technologies.

Search
Tag Cloud
...
Login
« Maven Sites and Sourceforge | Main | java.sql.Date Type(s) and the Offsetting Problem »
Sunday
May022010

Configuring Open Source JTA Transaction Managers with Spring

This blog post records in one place the Spring configuration required for each of the four most commonly used open source standalone transaction managers:

For Arjuna / JBossTS, apply the following configuration.:

<bean id="jbossTS"  class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple"  />
<bean id="jbossUserTransaction"  
    class="com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple"  />

<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManager" ref="jbossTS" />
    <property name="userTransaction" ref="jbossUserTransaction"  />
</bean>    

For JOTM, apply the following:

<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean" />
<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="userTransaction" ref="jotm" />
    <property name="allowCustomIsolationLevels" value="true" />
</bean>

For Atomikos, the following configuration can be used:

<bean id="atomikos" class="com.atomikos.icatch.jta.UserTransactionManager"  
    init-method="init" destroy-method="close">
   <property name="forceShutdown" value="false" />
</bean>

<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
   <property name="transactionTimeout" value="300" />
</bean>

<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
   <property name="transactionManager" ref="atomikos" />
   <property name="userTransaction" ref="AtomikosUserTransaction" />
</bean>

Finally, for Bitronix you can use the following:

<bean id="bitronixConfig" factory-method="getConfiguration" 
    class="bitronix.tm.TransactionManagerServices">
    <property name="serverId" value="spring-btm" />
</bean>
<bean id="bitronix" factory-method="getTransactionManager"
    class="bitronix.tm.TransactionManagerServices" depends-on="bitronixConfig" 
    destroy-method="shutdown" />
<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManager" ref="bitronix" />
    <property name="userTransaction" ref="bitronix" />
</bean>

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>