Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WAS 5.0 : XA datasource(9i) in a UserTransaction throws an error

 
Juzar Roopawalla
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a utility class I am starting a user transaction which contains an XA datasource(9i) and an XA enabled TCF. On the utx.begin() method there is an error thrown saying :
java.lang.IllegalStateException: Cannot start a global transaction. A LocalTransactionContainment is already active with work.
This method of the utility class is being called by a stateless session bean which is deployed using BMT demarcation and there is no utx used there.
Further in the exception trace a 'java.sql.SQLException: Use explicit XA call' message is also printed.
How to overcome this and make it work.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WAS likes to manage its own transactions and doesn't like you to interfere. It is possible for you to hook into the WAS transaction management to simulate this though.
I have the code to demonstrate this at work, but I don't have it available over the weekend.
Its based on this code which demonstrates wraping the WebSphere transaction management to implement the TransactionManager interface. The sample is used in Castor since Castor requires the TransactionManager to be available bound to JNDI for use in application servers. I hope you can unravel it from there.
Dave
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was asked to post the code I'm using since the stuff I refered to was specific to v4. This should work in both v4 and 5.
It uses Log4j logging, but you should be able to manage that...
Dave
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic