weblogic XA驅動的一個報錯
In this Document
Cause |
APPLIES TO:
Oracle SOA Suite - Version 11.1.1.3.0 and laterInformation in this document applies to any platform.
SYMPTOMS
WebLogic Datasource errors appearing in SOA server
log:
java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_NOTA start() failed on resource 'SOADataSource_base_domain': XAER_NOTA : The XID is not valid
ERROR
-----------------------
javax.ejb.TransactionRolledbackLocalException: Error committing transaction:; nested exception is: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_NOTA start() failed on resource 'SOADataSource_base_domain': XAER_NOTA : The XID is not valid
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1532)
Error Code: 0
Internal Exception: java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_NOTA start() failed on resource 'SOADataSource_base_domain': XAER_NOTA : The XID is not valid
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1532)
Error Code: 0
Caused by: java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_NOTA start() failed on resource 'SOADataSource_base_domain': XAER_NOTA : The XID is not valid
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1532)
javax.ejb.TransactionRolledbackLocalException: Error committing transaction:; nested exception is: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_NOTA sta
CAUSE
According to XA protocol it requires that all the SQL statements for one and the same transaction branch be issued between an xa_start() and an xa_end() call.
In case of a distributed transaction, every individual database represents one XAResource that will have one transaction branch in one distributed transaction. Now the WebLogic Server transaction manager considers every JDBC DataSource as a separate XAResource,
which means it cannot evaluate if different connection pools or data sources point to the same database.
This error can be seen when the transaction has timed out but the exception is not caught by the application.
SOLUTION
The solution is for the JDBC Connection Pools to set the XASetTransactionTimeout to true and XATransactionTimeout to zero (when this parameter is set to zero, the XAResource Session Timeout will be set to the global transaction timeout).
a. Log into WLS Administration Console
b. Click on Services -> Data Sources and then click on data source in question
c. Click on Transaction Tab
d. Click on check box next to "Set XA Transaction Timeout"
e. Make sure that "XA Transaction Timeout" has a value of 0
f. Save the configuration.
g. Bounce SOA
A general rule to follow is to make sure that WebLogic Server JTA timeout (either global, specific to an EJB or for individual