BTM
  1. BTM
  2. BTM-98

Getting details on Oracle XA Exception

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.1.0
    • Fix Version/s: 2.1.3
    • Labels:
      None
    • Environment:
      Oracle 10g2
    • Number of attachments :
      2

      Description

      When an Oracle XA exception occurs, it looks like we are getting too few details on the error to fix it.

      That's true it can be seen as an issue in Oracle JDBC (XA) Driver, but the fact is we get only this:

      Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an XAResourceHolderState with uniqueName=CBKDBMS XAResource=oracle.jdbc.driver.T4CXAResource@111089b with XID a Bitronix XID [737072696E672D62746D0000012C34CB08600000012B : 737072696E672D62746D0000012C34CB08600000012D], error=XAER_RMERR
      [...]
      ... 118 more
      Caused by: oracle.jdbc.xa.OracleXAException
      at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1045)
      at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:249)
      at bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:192)
      at bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:89)
      at bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:74)
      ... 120 more

      1. OracleExceptionAnalyzer.java
        2 kB
        Johann Dupuis
      2. TransactionManagerServices.java
        10 kB
        Johann Dupuis

        Activity

        Hide
        Ludovic Orban added a comment -

        I've just pushed the changes that make this mechanism present at all places where XAException is handled and published a new 2.1.3-SNAPSHOT version in codehaus' snapshots repo.

        Could you please have a look at it and let me know if this works up to your expecations? As a reminder, the instructions to access codehaus' snapshots repo is at http://docs.codehaus.org/display/BTM/Maven2#Maven2-Earlyversions

        Show
        Ludovic Orban added a comment - I've just pushed the changes that make this mechanism present at all places where XAException is handled and published a new 2.1.3-SNAPSHOT version in codehaus' snapshots repo. Could you please have a look at it and let me know if this works up to your expecations? As a reminder, the instructions to access codehaus' snapshots repo is at http://docs.codehaus.org/display/BTM/Maven2#Maven2-Earlyversions
        Hide
        Johann Dupuis added a comment -

        I will have a look before the end of next week. Sorry for the delay.

        Show
        Johann Dupuis added a comment - I will have a look before the end of next week. Sorry for the delay.
        Hide
        Johann Dupuis added a comment -

        The snapshot from 27 Feb 2012 looks fine to me, except:

        • in rollbacker.java, around line 199, there is a call to "Decoder.decodeXAExceptionErrorCode(xaException)" but we aren't handling 'extractExtraXAExceptionDetails'
        • in TransactionManagerServices.java, in function "getExceptionAnalyzer()", if the 'ClassLoaderUtils.loadClass' fails (due to mistake in exceptionAnalyzerName, packaging issue, ...) we are throwing a new InitializationException that would hide XAException or at least modify the handling of XAException in the caller method.
          Please find attached a proposal that adds a detailed error message in the log when 'ClassLoaderUtils.loadClass' fails but return the DefaultExceptionAnalyzer that would have no impact on caller method.
          To check that behaviour, I have:
          • Modified the Oracle JDBC Driver to return an Oracle XAException (instead of a javax.transaction.xa.XAException) in case privileges are missing
          • Start my application with no custom exception analyzer -> application fail to start because of missing privileges --> OK
          • Start my application with mispelled custom exception analyzer name -> InitializationException thrown -> the application is starting --> NOK
          • Apply patch to TransactionManagerServices#getExceptionAnalyzer, then start my application with mispelled custom exception analyzer name -> InitializationException in log BUT DefaultExceptionAnalyzer is used -> the application fail to start because of missing privileges --> OK
        Show
        Johann Dupuis added a comment - The snapshot from 27 Feb 2012 looks fine to me, except: in rollbacker.java, around line 199, there is a call to "Decoder.decodeXAExceptionErrorCode(xaException)" but we aren't handling 'extractExtraXAExceptionDetails' in TransactionManagerServices.java, in function "getExceptionAnalyzer()", if the 'ClassLoaderUtils.loadClass' fails (due to mistake in exceptionAnalyzerName, packaging issue, ...) we are throwing a new InitializationException that would hide XAException or at least modify the handling of XAException in the caller method. Please find attached a proposal that adds a detailed error message in the log when 'ClassLoaderUtils.loadClass' fails but return the DefaultExceptionAnalyzer that would have no impact on caller method. To check that behaviour, I have: Modified the Oracle JDBC Driver to return an Oracle XAException (instead of a javax.transaction.xa.XAException) in case privileges are missing Start my application with no custom exception analyzer -> application fail to start because of missing privileges --> OK Start my application with mispelled custom exception analyzer name -> InitializationException thrown -> the application is starting --> NOK Apply patch to TransactionManagerServices#getExceptionAnalyzer, then start my application with mispelled custom exception analyzer name -> InitializationException in log BUT DefaultExceptionAnalyzer is used -> the application fail to start because of missing privileges --> OK
        Hide
        Johann Dupuis added a comment -

        See 'getExceptionAnalyzer' function

        Show
        Johann Dupuis added a comment - See 'getExceptionAnalyzer' function
        Hide
        Ludovic Orban added a comment -

        Latest suggestions have been incorporated into the 2.1.x branch.

        Thanks for you help on this issue!

        Show
        Ludovic Orban added a comment - Latest suggestions have been incorporated into the 2.1.x branch. Thanks for you help on this issue!

          People

          • Assignee:
            Ludovic Orban
            Reporter:
            Johann Dupuis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: