aspose file tools*
The moose likes JBoss/WildFly and the fly likes XA DataSource configuration Error/Exception in JBoss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "XA DataSource configuration Error/Exception in JBoss" Watch "XA DataSource configuration Error/Exception in JBoss" New topic
Author

XA DataSource configuration Error/Exception in JBoss

Baiju Varugese
Ranch Hand

Joined: Dec 16, 2003
Posts: 74
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


Measure twice cut once carpenter theory <br /> <br />Baiju <br />SCJCP, SCBCD, IBM-486, IBM-484, SCEA Part I
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
I'm unclear on what an XA datasource has to do with UserTransaction, but the problem that you've probably run into is that you also need to configure the Xid padding in jboss-service.xml (in the conf directory).


Reid - SCJP2 (April 2002)
Baiju Varugese
Ranch Hand

Joined: Dec 16, 2003
Posts: 74
hi thanks,

while using the local transaction datasoure i am getting a exception,

you cannot commit the user transcation. so i changed the datasource to xa datasource.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XA DataSource configuration Error/Exception in JBoss
 
Similar Threads
Problem setting up dukes bank application with Oracle
Not Finding DataSource in JNDI Tree
Problem in putting a dataSource for the Oracle 9i database on JBoss for entity beans
Transaction not active error
org.jboss.tm.JBossRollbackException: Unable to commit