OracleXAException at OracleXAResource.checkError for JTA transaction involving Oracle XA Datasource in JBoss EAP
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5
- 6
- 7
Issue
An Oracle <xa-datasource> has been set up but the following exception is thrown when it is used:
... WARN [org.jboss.resource.connectionmanager.TxConnectionManager] (http-127.0.0.1-8080-1) Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@19eb1da[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@1ae7fd7 handles=0 lastUse=1291084253416 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@795184 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@d6ce13 xaResource=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@1ae7fd7 txSync=null]
oracle.jdbc.xa.OracleXAException
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:938)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:244)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.start(XAManagedConnection.java:213)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:799)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:510)
at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TransactionSynchronization.enlist(TxConnectionManager.java:908)
at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:662)
at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:403)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(BaseConnectionManager2.java:625)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:499)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
...
Resolution
Consult Oracle documentation or Oracle Support to ensure that XA is enabled for the database server1.
EAP 6/7
- Review the Example Oracle XA Datsource in the relevant EAP 6 or EAP 7 documentation and follow the steps outlined.
- Verify that the following properties are not omitted:
<xa-pool>
<is-same-rm-override>false</is-same-rm-override>
<no-tx-separate-pools />
</xa-pool>
- If using EAP 6.0.1, it may be required to apply the patch for BZ-922174
EAP 5
- Review Example B.6. Oracle XA Datasource
- Include the property
<isSameRM-override-value>false</isSameRM-override-value>
- Include the property
<no-tx-separate-pools></no-tx-separate-pools>
- Include the property
- See also 14.1. I have problems with Oracle XA , a useful link when there are some problems with Oracle XA.
-
Some Oracle versions may require the
initxa.sql
script to be run. ↩︎
Root Cause
JBoss prints a stacktrace for the exception but since the oracle.jdbc.xa.OracleXAException
has a null
exception message text/detail, Oracle specific APIs are required to extract the underlying error code(s).
Diagnostic Steps
- Enable Oracle TRACE as the root cause (e.g. an Oracle error code) may be reported through tracing
- Use the Byteman rules below to extract the error code(s)
# There are two different OracleXAException contructors that do not include text or a nested exception.
# http://docs.oracle.com/cd/E18283_01/appdev.112/e13995/oracle/jdbc/xa/OracleXAException.html
# Include rules for both as it is not known which might be used by underlying Oracle code
RULE ExtractOracleCheckErrorOraXAExceptionInt
CLASS oracle.jdbc.xa.OracleXAException
METHOD <init>(int)
IF callerEquals("oracle.jdbc.xa.OracleXAResource.checkError", true, true, 5)
DO traceStack("BMAN OracleXAResource.checkError throwing ORA-" + $1 + "\n", 6);
ENDRULE
RULE ExtractOracleCheckErrorOraXAExceptionIntInt
CLASS oracle.jdbc.xa.OracleXAException
METHOD <init>(int, int)
IF callerEquals("oracle.jdbc.xa.OracleXAResource.checkError", true, true, 5)
DO traceStack("BMAN OracleXAResource.checkError throwing ORA-" + $1 + ", XA_ER=" + $2 + "\n", 6);
ENDRULE
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments