Connection error OracleXAException -> XAResource.start, coul
emo Sep 3, 2007 12:01 AMI am starting out with the XA paradigm and am now confused. Sorry if this is a FAQ, but I cannot find it.
I have jboss-4.2.1.GA installed and just one configured XA Resource for now. I am trying to implement a Container Managed EJB, as per the O'Reilly EJB 3.0 textbook. So am not using UserTransactions. The call to datasource.getConnection throws a sequence of familiar sounding exceptions. Can I get some advice how this is supposed to work?
Many Thanks, E.
The code is as per JBoss Txn API 4.2.3 Programmers Guide, which advices the JNDI URL is prepended with jdbc:aruna
try {
InitialContext ic = new InitialContext();
datasource = (DataSource) ic.lookup
("java:comp/env/jdbc:arjuna:jdbc/myDataSource");
} catch (NamingException ne) { ...}
try {
dbConnection = datasource.getConnection();
} catch (Exception e) { ...}
The console error shows:
[TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@13cc73c
[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@13c5cc8 handles=0 lastUse=1188790474123 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@1ef5e7d context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@247b2e xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@1131d98 txSync=null]
oracle.jdbc.xa.OracleXAException
WARN [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror] [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror] TransactionImple.enlistResource - XAResource.start returned: XAException.XAER_RMERR
SQLException during retrieval of user profile : Could not enlist in transaction on entering meta-aware object!;
BTW, the JNDI tree shows:
java:comp namespace of the myUser bean:
+- env (class: org.jnp.interfaces.NamingContext)
| +- jdbc:arjuna:jdbc (class: org.jnp.interfaces.NamingContext)
| | +- myDataSource[link -> java:/XAOracleDS] (class: javax.naming.LinkRef)
The oracle-xa-ds.xml datasoure configuration is:
<!-- Datasource 1 -->
<xa-datasource>
<jndi-name>XAOracleDS</jndi-name>
<track-connection-by-tx/>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">jdbc:oracle:thin:@saki:1521:AC51</xa-datasource-property>
<xa-datasource-property name="User">tmsuser</xa-datasource-property>
<xa-datasource-property name="Password">tms</xa-datasource-property>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
<min-pool-size>0</min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>5</max-pool-size>
<!-- The time before an unused connection is destroyed -->
<!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
<!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
<idle-timeout-minutes>0</idle-timeout-minutes>
<!-- sql to call on an existing pooled connection when it is obtained from pool -->
<check-valid-connection-sql>select * from TMSUSR</check-valid-connection-sql>
<!-- class that determines a connection is valid before it is handed out from the pool -->
<valid-connection-checker-class-name>
org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker
</valid-connection-checker-class-name>
<!-- Whether to check all statements are closed when the connection is returned to the pool,
this is a debugging feature that should be turned off in production -->
<track-statements/>
<!-- Oracle's XA DS cannot reuse a connection outside a txn once enlisted in a global txn and vice-versa -->
<no-tx-separate-pools/>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<type-mapping>Oracle9i</type-mapping>
</xa-datasource>
jboss-service.xml
true