-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Dmitri Maximovich opened SPR-1206 and commented
Spring's TransactionProxies behavi inconsistent under WebLogic and JBoss. See attached sources for deatils and test case (SpringTxTest).
Here is a brief explanation of use case:
- XA DataSource created in App server
- JtaTransactionManager defined in Spring context
- BeanA and BeanB deployed with PROPAGATION_REQUIRES_NEW
- BeanA has DataSource and BeanB injected
- BeanA creates JDBC Connection from XA DataSource, executes insert into table and calls BeanB passing Connection as parameter of the call
- BeanB, using Connection passed, executes inserts into (same) table (this is supposed to happen in new transaction)
- BeanB throws RuntimeException (Spring is supposed to rollback BeanB's transaction)
- BeanA catches runtime exception from BeanB and ignoring it (so BeanA transaction supposed to finish successully)
Expected result: Table has 1 record in it after test run.
Result under WebLogic: 1 record.
Result under JBoss: 2 records.
No errors in log files, Spring saying that transaction is rolled back:
[txsuspend.spring.BeanA] A: test() begin
[org.springframework.transaction.interceptor.TransactionInterceptor] Getting transaction for txsuspend.spring.IBeanB.test
[org.springframework.transaction.jta.JtaTransactionManager] Using transaction object [org.springframework.transaction.jta.JtaTransactionObject@239525]
[org.springframework.transaction.jta.JtaTransactionManager] Creating new transaction, suspending current one
[org.springframework.transaction.jta.JtaTransactionManager] Suspending JTA transaction
[org.springframework.transaction.support.TransactionSynchronizationManager] Clearing transaction synchronization
[org.springframework.transaction.jta.JtaTransactionManager] Beginning JTA transaction
[org.springframework.transaction.support.TransactionSynchronizationManager] Initializing transaction synchronization
[txsuspend.spring.BeanB] B: test() begin
[txsuspend.spring.BeanB] Throwing exception from B
[org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] Applying rules to determine whether transaction should rollback on java.lang.RuntimeException: test from B
[org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] Winning rollback rule is: null
[org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] No relevant rollback rule found: applying superclass default
[org.springframework.transaction.interceptor.TransactionInterceptor] Invoking rollback for transaction on txsuspend.spring.IBeanB.test due to throwable [java.lang.RuntimeException: test from B]
[org.springframework.transaction.jta.JtaTransactionManager] Triggering beforeCompletion synchronization
[org.springframework.transaction.jta.JtaTransactionManager] Initiating transaction rollback
[org.springframework.transaction.jta.JtaTransactionManager] Rolling back JTA transaction
[org.springframework.transaction.jta.JtaTransactionManager] Triggering afterCompletion synchronization
[org.springframework.transaction.support.TransactionSynchronizationManager] Clearing transaction synchronization
[org.springframework.transaction.jta.JtaTransactionManager] Resuming suspended transaction
[org.springframework.transaction.support.TransactionSynchronizationManager] Initializing transaction synchronization
[org.springframework.transaction.jta.JtaTransactionManager] Resuming JTA transaction
[txsuspend.spring.BeanA] Exception from BeanB cached, ignoring
[txsuspend.spring.BeanA] A: test() done
[org.springframework.transaction.interceptor.TransactionInterceptor] Invoking commit for transaction on txsuspend.spring.IBeanA.test
[org.springframework.transaction.jta.JtaTransactionManager] Triggering beforeCommit synchronization
[org.springframework.transaction.jta.JtaTransactionManager] Triggering beforeCompletion synchronization
[org.springframework.transaction.jta.JtaTransactionManager] Initiating transaction commit
[org.springframework.transaction.jta.JtaTransactionManager] Committing JTA transaction
[org.springframework.transaction.jta.JtaTransactionManager] Triggering afterCompletion synchronization
[org.springframework.transaction.support.TransactionSynchronizationManager] Clearing transaction synchronization
Affects: 1.2.3
Attachments:
- applicationContext.xml (1.64 kB)
- BeanA.java (1.09 kB)
- BeanB.java (756 bytes)
- Constants.java (155 bytes)
- IBeanA.java (84 bytes)
- IBeanB.java (136 bytes)
- Something.java (606 bytes)
- SpringTxTest.java (2.18 kB)