I would be grateful if someone with access to the source could illuminate what might cause this problem. Using GF v2ur1 + included Derby DB + toplink.
I have written a Resource Adapter, that passes requests to an MDB.
The RA does the XA actions while the MDB invokes other EJB's methods to do work within the transaction.
I am getting the exception below when I try to retry an aborted operation. The steps leading up to this were:
1. RA created a new ExecutionContext with an imported XID.
2. RA passed an action request to the MDB.
3. MDB inserted a record in the DB.
4. RA invoked XATerminator.prepare() which failed (threw an XAException) because the inserted record's key already exists.
5. RA invoked XATerminator.rollback() for the imported XID.
6. RA created a new (second) ExecutionContext with the same XID.
7. RA passed the same (retried) action request to the MDB. Note that a new MDB was created by the container - this surprises me but AFAIK it's legal (but unnecessary?).
8. MDB inserted the record in the DB again.
9. RA invoked XATerminator.prepare() getting the exception stack below.
[#|2008-12-22T10:28:02.082-0500|INFO|sun-appserver9.1|com.example.xa.ExampleResourceAdapter|_ThreadID=56;_ThreadName=InboundConnection;|AIRAInboundConnection::run() received command 23|#]
[#|2008-12-22T10:28:02.082-0500|INFO|sun-appserver9.1|com.example.xa.ExampleResourceAdapter|_ThreadID=56;_ThreadName=InboundConnection;|AIRAInboundConnection::handle_MSG_XA_PREPARE|#]
[#|2008-12-22T10:28:02.098-0500|INFO|sun-appserver9.1|com.example.xa.ExampleResourceAdapter|_ThreadID=56;_ThreadName=InboundConnection;|AIRAInboundConnection::handle_MSG_XA_PREPARE(0)|#]
[#|2008-12-22T10:28:02.098-0500|SEVERE|sun-appserver9.1|javax.enterprise.system.core.transaction|_ThreadID=56;_ThreadName=InboundConnection;_RequestID=aaad3aa9-0f09-40c7-93f3-60c4cc29ebad;|JTS5009: Cannot create CoordinatorResource object reference
org.omg.PortableServer.POAPackage.ObjectAlreadyActive: IDL:omg.org/PortableServer/POA/ObjectAlreadyActive:1.0
at com.sun.corba.ee.impl.oa.poa.AOMEntry$6.doIt(AOMEntry.java:137)
at com.sun.corba.ee.impl.orbutil.fsm.StateEngineImpl.performStateTransition(StateEngineImpl.java:288)
at com.sun.corba.ee.impl.orbutil.fsm.StateEngineImpl.innerDoIt(StateEngineImpl.java:254)
at com.sun.corba.ee.impl.orbutil.fsm.StateEngineImpl.doIt(StateEngineImpl.java:170)
at com.sun.corba.ee.spi.orbutil.fsm.FSMImpl.doIt(FSMImpl.java:104)
at com.sun.corba.ee.impl.oa.poa.AOMEntry.activateObject(AOMEntry.java:245)
at com.sun.corba.ee.impl.oa.poa.POAPolicyMediatorBase_R.activateObject(POAPolicyMediatorBase_R.java:120)
at com.sun.corba.ee.impl.oa.poa.POAImpl.activate_object_with_id(POAImpl.java:1290)
at com.sun.jts.CosTransactions.CoordinatorResourceImpl.object(CoordinatorResourceImpl.java:898)
at com.sun.jts.CosTransactions.TopCoordinator.register_resource(TopCoordinator.java:1247)
at com.sun.jts.jta.TransactionState.startAssociation(TransactionState.java:288)
at com.sun.jts.jta.TransactionImpl.enlistResource(TransactionImpl.java:205)
at com.sun.enterprise.distributedtx.J2EETransaction.enlistResource(J2EETransaction.java:562)
at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.enlistResource(J2EETransactionManagerImpl.java:372)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.enlistResource(J2EETransactionManagerOpt.java:144)
at com.sun.enterprise.resource.SystemResourceManagerImpl.enlistResource(SystemResourceManagerImpl.java:98)
at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:216)
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:337)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:189)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:158)
at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:108)
at oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:145)
at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:184)
at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:233)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.connect(DatabaseAccessor.java:242)
at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.reconnect(DatasourceAccessor.java:436)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.reconnect(DatabaseAccessor.java:1177)
at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.incrementCallCount(DatasourceAccessor.java:220)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:479)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:452)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeCall(AbstractSession.java:690)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:214)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:346)
at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:191)
at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:205)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:564)
at oracle.toplink.essentials.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:89)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:750)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:714)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:602)
at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:162)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:390)
at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:109)
at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:555)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:138)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:110)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2233)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:269)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:190)
at oracle.toplink.essentials.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:2657)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1044)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:403)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1126)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.issueSQLbeforeCompletion(UnitOfWorkImpl.java:2443)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.issueSQLbeforeCompletion(RepeatableWriteUnitOfWork.java:202)
at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:131)
at oracle.toplink.essentials.transaction.JTASynchronizationListener.beforeCompletion(JTASynchronizationListener.java:91)
at com.sun.jts.jta.SynchronizationImpl.before_completion(SynchronizationImpl.java:99)
at com.sun.jts.CosTransactions.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:158)
at com.sun.jts.CosTransactions.TopCoordinator.beforeCompletion(TopCoordinator.java:2548)
at com.sun.jts.CosTransactions.XATerminatorImpl.prepare(XATerminatorImpl.java:254)
at com.example.xa.AIRAInboundConnection.handle_MSG_XA_PREPARE(AIRAInboundConnection.java:463)
at com.example.xa.AIRAInboundConnection.run(AIRAInboundConnection.java:136)
at java.lang.Thread.run(Thread.java:619)
|#]
[Message sent by forum member 'matterbury' (matterbury)]
http://forums.java.net/jive/thread.jspa?messageID=322958