This content has been marked as final.
Show 3 replies
-
1. Re: Problem looking up XADatasource - Always returns Datasou
vickyk Oct 27, 2008 8:23 AM (in response to pradeeps)"pradeeps" wrote:
How do I tell JBOSS that I need the looked up object to be XADatasource?
I am not sure what exactly you want to do with the XADataSource, you should not be trying to get the XADataSource this way.
If you need to XADataSource you can construct it asOracleXADataSource xads = new OracleXADataSource();
-
2. Re: Problem looking up XADatasource - Always returns Datasou
pradeeps Oct 27, 2008 9:14 AM (in response to pradeeps)Thanks for the reply.
The connection that is gotten from this datasource is going to participate in a distributed transaction with JMS XA QueueConnectionFactory. I am using the Atomikos JTA API.
This distributed TX will happen only if both the resources support XA.
Are you recommending that I create the XADataSource object in my code and not look up using JNDI?
Thanks. -
3. Re: Problem looking up XADatasource - Always returns Datasou
vickyk Oct 27, 2008 12:21 PM (in response to pradeeps)"pradeeps" wrote:
The connection that is gotten from this datasource is going to participate in a distributed transaction with JMS XA QueueConnectionFactory. I am using the Atomikos JTA API.
This distributed TX will happen only if both the resources support XA.
Are you recommending that I create the XADataSource object in my code and not look up using JNDI?
Thanks.
I assume that you must have Atomikos TM configured with the JBoss.Now when you are getting the connection from the xa-datasource the jca framework will transparently enlist the connection associated with the datasource in the ongoing transaction.
Here is the psuedo code :UserTransaction utx = (UserTransaction) ctx.lookup("UserTransaction"); Getting JMS XA QueueConnectionFactory from JNDI Getting JMS session which will also enlist the corresponding XAResource in the ongoing TX DataSource ds = (DataSource) ctx.lookup("java:/pxDS"); Connection con = ds.getConnection(); // Here JCA will enlist the connection(precisely XAResource) in ongoing JTA transaction transparently. utx.commit();