[jbossts-issues] [JBoss JIRA] Commented: (JBTM-619) Cannot enlist two Oracle XAConnection resources in one transaction

Jonathan Halliday (JIRA) jira-events at lists.jboss.org
Thu Mar 17 05:34:46 EDT 2011

    [ https://issues.jboss.org/browse/JBTM-619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588542#comment-12588542 ] 

Jonathan Halliday commented on JBTM-619:

This is caused by Oracle's inability to deal with TMJOIN.
When enlisting another resource for an RM that is already participating in the tx, the tm will issue a TMJOIN on the existing branch it order to avoid 2PC. Unfortunately Oracle barfs when you do that.

Workaround: since the Oracle driver implements isSameRM using basically this.getURL().equals(that.getURL()) you can cause it to treat the two connections as different RMs by using host aliases in the url, or putting the username/password in the url.
ref http://community.jboss.org/message/5435

Internal Notes:

TransactionImple.enlistResource calls
    OracleXARresource.isSameRM returns true
  causes a start(xid, XAResource.TMJOIN) for the pre-existing branch xid on the new xaresource, which throws XAER_RMERR
  could hack isNewRM to have special case for Oracle?

internally Oracle 'optimizes' the two branches on same RM case by having one return XA_RDONLY, but that does not allow for fully optimizing 2PC to 1PC even in TMs that have custom code to deal with tx containing multiple Oracle resources. Not worth the hassle.
ref http://download.oracle.com/docs/cd/E11882_01/java.112/e16548/xadistra.htm#sthref1066

re: Oracle MOS Doc ID 1082204.1, where users have 'grant force any transaction' the RM returns XA_RETRY rather than XAER_RMERR, although the error is not actually transient.

> Cannot enlist two Oracle XAConnection resources in one transaction
> ------------------------------------------------------------------
>                 Key: JBTM-619
>                 URL: https://issues.jboss.org/browse/JBTM-619
>             Project: JBoss Transaction Manager
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: JTA
>    Affects Versions: 4.7.0
>         Environment: Windows and Linux.
>            Reporter: Wade Poziombka
>            Assignee: Jonathan Halliday
>              Labels: JTS, Oracle
>             Fix For: 4.15.0
> An attempt to enlist two Oracle connections causes the second enlistResource to fail with an exception similar to:
> oracle.jdbc.xa.OracleXAException
>         at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:938)
>         at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:244)
>         at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:902)
>         at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:513)
> Note the line number changes a bit depending on version of Oracle JDBC etc.  However, the affect is always the same.
> There are others who noted this problem on the forum with no resolution or reply (except my own concurring with the observation).
> In particular two connections to same server using different user id's and passwords.  I will test whether two completely separate oracle instances have this issue and update the bug.  

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

More information about the jbossts-issues mailing list