ManagedConnection.cleanup called before XAResource.end

I am the developer for a JCA 1.5 resource adapter named DTPRA. Note that DTPRA works with WebSphere Application Server, WebLogic Application Server and JBoss Application Server.

I have never tested DTPRA with the Sun App Server, so I downloaded Sun Java System Application Server Enterprise Edition 8.2 (build b25-fcs) to test DTPRA.

After overcoming a number of other issues, I encountered a problem which has me stalled at this point.

I tried a simple transaction request. At the end of the 揳ctive?phase of processing, the App Server called the ManagedConnection.cleanup method prior to calling to the XAResource.end method. When the XAResource.end method was called later, DTPRA threw the exception because the state was wrong (the managed connection was no longer involved in a transaction). Here is an excerpt from the DTPRA trace:

-

06/27/07 13:27:32.340 RA=dtpraTYPE=FINERTHD=0084e723-service-j2ee

DtpInteraction.execute: returning from execute a value oftrue

DtpConnection.destroyInteraction: Entering method

DtpConnection.close: Entering method close (for connectioncom.unisys.dtp.connector.DtpConnection@557c15)

DtpConnection.closeConnection: no interactions to close

DtpConnection.closeConnection: connection com.unisys.dtp.connector.DtpConnection@557c15 no longer active

DtpManagedConnection.fireConnectionClosedEvent: Firing Connection closed event; 1 listeners() registered

DtpManagedConnection.cleanup: Entering method

-

06/27/07 13:27:32.340 RA=dtpraTYPE=FINETHD=0084e723-service-j2ee

DtpManagedConnection.cleanup: Clean Up Request: 1 connection(s) active

-

06/27/07 13:27:32.340 RA=dtpraTYPE=FINERTHD=0084e723-service-j2ee

DtpManagedConnection.cleanup: ManagedConnection cleanup successful

DtpXAResource.end: xa_end called flags = TMSUCCESS (0x4000000)

-

06/27/07 13:27:32.340 RA=dtpraTYPE=FINEST THD=0084e723-service-j2ee

DtpResourceAdapter.createXid: txHelper is null...

-

06/27/07 13:27:32.340 RA=dtpraTYPE=SEVERE THD=0084e723-service-j2ee

DtpManagedConnection.transactionCompleted: Throwing exception.

javax.resource.spi.IllegalStateException: XA_END Received but ManagedConnection not currently participating in transaction, error code: NO_TRANS

at com.unisys.dtp.connector.DtpManagedConnection.transactionCompleted(DtpManagedConnection.java:1014)

at com.unisys.dtp.connector.DtpXAResource.end(DtpXAResource.java:160)

at com.sun.jts.jta.TransactionState.beforeCompletion(TransactionState.java:125)

at com.sun.jts.jta.SynchronizationImpl.before_completion(SynchronizationImpl.java:62)

at com.sun.jts.CosTransactions.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:120)

at com.sun.jts.CosTransactions.TopCoordinator.beforeCompletion(TopCoordinator.java:2491)

The Sun App Server behavior looks incorrect to me. I reviewed the JCA 1.5 spec (page 6-43 shows a nice diagram), and it looks like the App Server is supposed to call XAResource.end before the App Server calls ManagedConnection.cleanup. This is what DTPRA expects and gets with the other App Servers.

[3266 byte] By [burdeasaa] at [2007-11-27 9:03:08]
# 1
Can you try after setting the system property ALLOW_MULTIPLE_ENLISTS_DELISTS as trueadd the entry :<jvm-options>-DALLOW_MULTIPLE_ENLISTS_DELISTS=true</jvm-options> in your domain.xml and restart app.server
Jagadish.Prasatha at 2007-7-12 21:34:48 > top of Java-index,Application & Integration Servers,Application Servers...
# 2

I set ALLOW_MULTIPLE_ENLISTS_DELISTS to true and restarted the App Server.

This worked! Now XAResource.end is called before ManagedConnection.cleanup, as I expected. No errors occur and the transactions are committed properly.

Thanks a lot for your help.

But now I have some follow up questions:

1) I searched the Sun document online and did a google. I did not find anything on the property ALLOW_MULTIPLE_ENLISTS_DELISTS. Is this documented somewhere?

2) At some point I will probably need to document for my users how to use DTPRA with the Sun App Server. But I am wondering what side effects, if any, there are if I were to tell my customers to always set this property when using DTPRA with Sun App Server. Can you tell me more about this property?

Thanks again!

burdeasaa at 2007-7-12 21:34:48 > top of Java-index,Application & Integration Servers,Application Servers...