Hi,
I need to user UserTransaction object, so i configured XADatasource in
JBoss, the configuration details is given below.
<xa-datasource>
<jndi-name>OFWSource</jndi-name>
<track-connection-by-tx>true</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 racle:thin:@localhost:1521:myuser</xa-datasource-property>
<xa-datasource-property name="User">scott</xa-datasource-property>
<xa-datasource-property name="Password">tiger</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>
<!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global transaction and vice-versa -->
<no-tx-separate-pools/>
<!-- sql to call when connection is created-->
<new-connection-sql>select * from er_user</new-connection-sql>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional)
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata> -->
When i tried to use the resource
initCtx = new InitialContext();
org.jboss.resource.adapter.jdbc.WrapperDataSource ds = (org.jboss.resource.adapter.jdbc.WrapperDataSource) initCtx.lookup(dataSource);
Connection connection = ds.getConnection();
i am getting following exception while using the connection object
Error while creating connection due to::: Could not enlist in transaction on entering meta-aware object!javax.transaction.SystemException: Could not get XAResource from ManagedConnection!javax.transaction.RollbackException: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=BLR2-2F-006a/23, BranchQual=, localId=23]; - nested throwable: (javax.resource.ResourceException: Could not enlist in transaction on entering meta-aware object!javax.transaction.SystemException: Could not get XAResource from ManagedConnection!javax.transaction.RollbackException: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=BLR2-2F-006a/23, BranchQual=, localId=23])
please help me
thanks