AS4.2.2.GA + Hibernate + XADatasource 2 transactions not coo
gsniderjboss Mar 21, 2008 10:45 AMSee specs at bottom for app & db versions:
I'm seeing the following in jboss/hibernate with CMT
1) SLEJB using Hibernate: TransactionManager creates TX1
2) Same EJB gets Xid from transaction and calls WorkManager with ExecutionContext.setXid()
//import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple //import com.arjuna.ats.jta.TransactionManager //import com.arjuna.ats.jta.xa.XidImple TransactionImple tx = (TransactionImple)TransactionManager.transactionManager().getTransaction(); XidImple xidimple = new XidImple(tx.get_uid()); ExecutionContext ctx2 = new ExecutionContext(); ctx2.setXid(xid); workManager.scheduleWork(someObject, WorkManager.INDEFINITE, ctx2, listener);
3) it's when calling WorkManager.scheduleWork that I get the exceptions below
DEBUG [mycode] TX1 xidimple = a3291b1:da3:47e2d26a:58 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] StateManager::StateManager( 2 ) DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] BasicAction::BasicAction() DEBUG [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_10] - BasicAction::addAction () action a3291b1:da3:47e2d26a:58 adding a3291b1:da3:47e2d26a:62 Why is it adding one here? WorkManager acts like it didn't recognize that the Xid from TX1 was already passed in (a3291b1:da3:47e2d26a:58). Is there some special formatting I need from com.arjuna.ats.jta.xa.XidImple xidimple = new com.arjuna.ats.jta.xa.XidImple(tx.get_uid());? DEBUG [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_11] - BasicAction::addChildAction () action a3291b1:da3:47e2d26a:58 adding a3291b1:da3:47e2d26a:62 result = true DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] BasicAction::Begin() for action-id a3291b1:da3:47e2d26a:62 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] BasicAction::actionInitialise() for action-id a3291b1:da3:47e2d26a:62 DEBUG [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_66] - Action a3291b1:da3:47e2d26a:62 with parent status 0 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] ActionHierarchy::add(a3291b1:da3:47e2d26a:62, 1) DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.registerSynchronization ERROR [STDERR] java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.syncsnotallowed] [com.arjuna.ats.internal.jta.transaction.arjunacore.syncsnotallowed] Synchronizations are not allowed! ERROR [STDERR] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.registerSynchronizationImple(TransactionImple.java:473) ERROR [STDERR] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.registerSynchronization(TransactionImple.java:441) ERROR [STDERR] at com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator.registerWork(XATerminator.java:138) ERROR [STDERR] at org.jboss.resource.work.JBossWorkManager.importWork(JBossWorkManager.java:187) ERROR [STDERR] at org.jboss.resource.work.JBossWorkManager.scheduleWork(JBossWorkManager.java:143) ERROR [STDERR] java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.syncsnotallowed] [com.arjuna.ats.internal.jta.transaction.arjunacore.syncsnotallowed] Synchronizations are not allowed!
I checked the code for com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple.registerSynchronizationImple
It has a switch statement on the tx status. If it's not ActionStatus.ABORTED or ActionStatus.CREATED, it throws the error above (synchronizations are not allowed!). I checked the status of the tx right before the call and it is ActionStatus.RUNNING.
Should this call still fail even though the TX is Running?
******************
JBoss 4.2.2.GA (JBossTS 4.2.2 implied)
MySQL XA Driver 5.1.5
XA Datasource configured