Atomikos Forum

Having multiple resources with single database?

Is it possible to have multiple XAResources / XAConnections pointing to the same database, or feeding from the same XADataSource?

I tried, but the transaction manager will not accept a second XAResource object that was taken from the same XADatasource, because it says I must delist before re-enlisting.
theowne Send private email
Saturday, August 20, 2011
 
 
Should be possible. Can you post a stack trace with some more context?
Guy Pardon Send private email
Saturday, August 20, 2011
 
 
There isn't much of a stack trace to be honest:

java.lang.IllegalStateException: The given XAResource instance is being enlisted a second time without delist in between?
    at com.atomikos.icatch.jta.TransactionImp.enlistResource(TransactionImp.java:357)
    at XAClass.main(XAClass.java:93)

Where XAClass is my own class calling it.  The context is pretty simple, the code is like this:

create an XADataSource and connect
Get two XAConnections from this Datasource, and then get XAResources from those connections.
Create transaction
Attempt to enlist both XAConnections, but it throws this error when it reaches the second.  They are two individual XAConnections, different IDs, but all I can think of is they come from the same datasource.
Theowne1 Send private email
Monday, August 22, 2011
 
 
OK

Seems like something suspicious in our JTA interface (which is not used in our datasource connectors - which is probably why nobody noticed so far). There is a check for isSameRM and that seems a bit too pessimistic (XAResourceKey class).

I created an issue to look at this.

Thanks!
Guy Pardon Send private email
Monday, August 22, 2011
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics