org.springframework.transaction.jta
Class WebLogicJtaTransactionManager

java.lang.Object
  extended byorg.springframework.transaction.support.AbstractPlatformTransactionManager
      extended byorg.springframework.transaction.jta.JtaTransactionManager
          extended byorg.springframework.transaction.jta.WebLogicJtaTransactionManager
All Implemented Interfaces:
InitializingBean, PlatformTransactionManager, Serializable

public class WebLogicJtaTransactionManager
extends JtaTransactionManager

Special JtaTransactionManager version for BEA WebLogic. Invokes WebLogic's proprietary "forceResume" method if standard JTA resume failed, to also resume if the target transaction was marked rollback-only. If you're not relying on this feature of transaction suspension in the first place, simply use Spring's standard JtaTransactionManager.

Also sets JtaTransactionManager's "transactionManagerName" property to WebLogic's default JNDI name for its JTA TransactionManager: "javax.transaction.TransactionManager". This can alternatively be achieved through a standard JtaTransactionManager definition with a corresponding "transactionManagerName" property value.

Will work out-of-the-box on BEA WebLogic 8.1 and higher (tested on 8.1 SP2). On WebLogic 7.0 SP2, a "forceResume" call on the TransactionManager reference obtained from JNDI unfortunately fails with a mysterious, WebLogic-internal NullPointerException. (Thanks to Eugene Kuleshov and Dmitri Maximovich for tracking down and reporting this issue!)

The solution for WebLogic 7.0 is to wire the "transactionManager" property with a WebLogicServerTransactionManagerFactoryBean. This factory bean provides a reference to the ServerTransactionManagerImpl via WebLogic's TxHelper class. This has been tested on WebLogic 7.0 SP5. The TxHelper lookup is available on WebLogic 8.1, but deprecated - so we recommend the default JNDI lookup there.

 <bean id="wlsTm" class="org.springframework.transaction.jta.WebLogicServerTransactionManagerFactoryBean"/>

 <bean id="transactionManager" class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
   <property name="transactionManager"><ref local="wlsTm"/></property>
 </bean>

Since:
1.1
Author:
Juergen Hoeller
See Also:
JtaTransactionManager.setTransactionManagerName(java.lang.String), DEFAULT_TRANSACTION_MANAGER_NAME, WebLogicServerTransactionManagerFactoryBean, weblogic.transaction.TransactionManager#forceResume, Serialized Form

Field Summary
static String DEFAULT_TRANSACTION_MANAGER_NAME
          Default JNDI name of WebLogic's JTA TransactionManager: "javax.transaction.TransactionManager".
 
Fields inherited from class org.springframework.transaction.jta.JtaTransactionManager
DEFAULT_USER_TRANSACTION_NAME
 
Fields inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION
 
Constructor Summary
WebLogicJtaTransactionManager()
          This constructor retrieves the WebLogic JTA TransactionManager interface, so we can invoke the forceResume method using reflection.
 
Method Summary
protected  void doJtaResume(Transaction suspendedTransaction)
          Perform a JTA resume on the JTA TransactionManager.
 
Methods inherited from class org.springframework.transaction.jta.JtaTransactionManager
afterPropertiesSet, applyIsolationLevel, doBegin, doCommit, doGetTransaction, doJtaSuspend, doResume, doRollback, doSetRollbackOnly, doSuspend, getJndiTemplate, getTransactionManager, getUserTransaction, isExistingTransaction, lookupTransactionManager, lookupUserTransaction, setAutodetectTransactionManager, setJndiTemplate, setTransactionManager, setTransactionManagerName, setUserTransaction, setUserTransactionName, useSavepointForNestedTransaction
 
Methods inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
commit, doCleanupAfterCompletion, getTransaction, getTransactionSynchronization, isNestedTransactionAllowed, isRollbackOnCommitFailure, rollback, setNestedTransactionAllowed, setRollbackOnCommitFailure, setTransactionSynchronization, setTransactionSynchronizationName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TRANSACTION_MANAGER_NAME

public static final String DEFAULT_TRANSACTION_MANAGER_NAME
Default JNDI name of WebLogic's JTA TransactionManager: "javax.transaction.TransactionManager".

See Also:
JtaTransactionManager.setTransactionManagerName(java.lang.String), Constant Field Values
Constructor Detail

WebLogicJtaTransactionManager

public WebLogicJtaTransactionManager()
This constructor retrieves the WebLogic JTA TransactionManager interface, so we can invoke the forceResume method using reflection.

Method Detail

doJtaResume

protected void doJtaResume(Transaction suspendedTransaction)
                    throws SystemException
Description copied from class: JtaTransactionManager
Perform a JTA resume on the JTA TransactionManager.

Can be overridden in subclasses, for specific JTA implementations.

Overrides:
doJtaResume in class JtaTransactionManager
Parameters:
suspendedTransaction - the suspended JTA Transaction object
Throws:
SystemException - if thrown by JTA methods
See Also:
JtaTransactionManager.getTransactionManager()


Copyright (C) 2003-2004 The Spring Framework Project.