1. 程式人生 > >weblogic XA驅動的一個報錯

weblogic XA驅動的一個報錯

In this Document

Cause

APPLIES TO:

Oracle SOA Suite - Version 11.1.1.3.0 and later
Information 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
-----------------------

2011-12-16T00:01:33.791+10:30] [soa_server1] [ERROR] [] [oracle.soa.bpel.engine.dispatch] [tid: orabpel.invoke.pool-4.thread-13] [userId: <anonymous>] [ecid: 0000JH1ufkSD4iP5Mf9Die1EuSQh0001xR,0:7:100000066] [APP: soa-infra] [dcid: 5f7dda500ef01573:-39ff5479:1344130a57d:-7ffc-0000000000000011] <DispatchHelper::handleMessage> failed to handle message[[
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