Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XA DataSource configuration Error/Exception in JBoss

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Baiju Varugese
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic