aspose file tools*
The moose likes Websphere and the fly likes Transaction related problem while using multiple resource in WebSphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Transaction related problem while using multiple resource in WebSphere" Watch "Transaction related problem while using multiple resource in WebSphere" New topic
Author

Transaction related problem while using multiple resource in WebSphere

Subhash Namboodiri
Ranch Hand

Joined: Jan 02, 2003
Posts: 30
Using stateless session beans, with "Required" transaction attribute, unable to publish JMS messages and also modify entity beans in a single EJB transaction:
In the same EJB transaction, it is required to modify entity beans and also need to publish JMS messages. With the use of nonXA datasource and nonXA Connection Factories, exception was shown saying XA resources were required.
We then modified datasource and connection-factories to be XA resources but then failed with different exception messages.
We have also tried different combinations like XA datasource and nonXA CF, nonXA datasource and XA CF but again failed.
XA resources were created using administrative console in NODE scope mode.
DB: Oracle 8i, JDBC: classes12.zip (thin driver)
NB: Will it be a problem if one resource is created in the Node scope and the other in server scope?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
No, it's not a problem to define them in different scopes. And yes, they both must be defined as being XA. Can you post the message you get when they are both defined as being XA?
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Subhash Namboodiri
Ranch Hand

Joined: Jan 02, 2003
Posts: 30
The stateless SessionBean is under container managed transaction. All the methods are having the attribute as "Required". Both dataSource and QueueConnectionFactory are of XA type. The following error is thrown in SystemOut.log.

[1/13/03 11:59:45:082 IST] 24a85565 WSRdbXaResour W DSRA0302E: XAException occurred. Error code is: XAER_RMERR. Exception is: <null>
[1/13/03 11:59:47:546 IST] 24a85565 XATransaction E J2CA0030E: Method enlist caught javax.transaction.SystemException: Failed to start the transaction association.
at com.ibm.ejs.jts.jta.TransactionImpl.enlistResource(TransactionImpl.java:757)
at com.ibm.ejs.jts.jta.JTSXA.enlist(JTSXA.java:998)
at com.ibm.ejs.j2c.XATransactionWrapper.enlist(XATransactionWrapper.java:598)
at com.ibm.ejs.j2c.ConnectionEventListener.interactionPending(ConnectionEventListener.java:696)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processInteractionPendingEvent(WSRdbManagedConnectionImpl.java:1132)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.beginTransactionIfNecessary(WSJdbcConnection.java:429)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.createStatementCommon(WSJdbcConnection.java:736)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.createStatement(WSJdbcConnection.java:697)
at com.savvion.sbm.util.Sequence.createSequenceInDB(Sequence.java:137)
at com.savvion.sbm.util.Sequence.init(Sequence.java:114)
at com.savvion.sbm.util.Sequence.<init>(Sequence.java:91)
at com.savvion.sbm.bizlogic.util.BLUtil.initSequence(BLUtil.java:443)
at com.savvion.sbm.bizlogic.util.BLControl.start(BLControl.java:316)
at com.savvion.sbm.bizlogic.server.ejb.BLServerBean.start(BLServerBean.java:170)
at com.savvion.sbm.bizlogic.server.ejb.EJSRemoteStatelessBLServerBean_e586166b.start(Unknown Source)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie.start(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:504)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie._invoke(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:97)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:582)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:437)
at com.ibm.rmi.iiop.ORB.process(ORB.java:320)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1544)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2063)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
while trying to enlist resources from datasource jdbc/BizLogicDB with the Transaction Manager for the current transaction, and threw a ResourceException.
[1/13/03 11:59:49:308 IST] 24a85565 XATransaction E J2CA0026E: Method addSync caught javax.transaction.RollbackException
at com.ibm.ejs.jts.jta.TransactionImpl.registerSynchronization(TransactionImpl.java:955)
at com.ibm.ejs.jts.jta.JTSXA.registerSynchronization(JTSXA.java:1096)
at com.ibm.ejs.j2c.XATransactionWrapper.addSync(XATransactionWrapper.java:254)
at com.ibm.ejs.j2c.ConnectionManager.initializeForUOW(ConnectionManager.java:776)
at com.ibm.ejs.j2c.ConnectionManager.involveMCInTran(ConnectionManager.java:622)
at com.ibm.ejs.j2c.ConnectionManager.associateConnection(ConnectionManager.java:1150)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.reactivate(WSJdbcConnection.java:1508)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.getTransactionIsolation(WSJdbcConnection.java:1079)
at com.savvion.sbm.util.SBMDAOService.closeConnection(SBMDAOService.java:169)
at com.savvion.sbm.util.SBMDAOService.clean(SBMDAOService.java:192)
at com.savvion.sbm.util.Sequence.createSequenceInDB(Sequence.java:169)
at com.savvion.sbm.util.Sequence.init(Sequence.java:114)
at com.savvion.sbm.util.Sequence.<init>(Sequence.java:91)
at com.savvion.sbm.bizlogic.util.BLUtil.initSequence(BLUtil.java:443)
at com.savvion.sbm.bizlogic.util.BLControl.start(BLControl.java:316)
at com.savvion.sbm.bizlogic.server.ejb.BLServerBean.start(BLServerBean.java:170)
at com.savvion.sbm.bizlogic.server.ejb.EJSRemoteStatelessBLServerBean_e586166b.start(Unknown Source)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie.start(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:504)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie._invoke(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:97)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:582)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:437)
at com.ibm.rmi.iiop.ORB.process(ORB.java:320)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1544)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2063)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
while trying to register the Resource Adapter with the Synchronization Manager for the current transaction, and threw a ResourceException.
[1/13/03 11:59:49:999 IST] 24a85565 WSJdbcConnect W DSRA9400E: Fatal error occurred during Connection reassociation: javax.resource.ResourceException: addSync: caught Exception
at com.ibm.ejs.j2c.XATransactionWrapper.addSync(XATransactionWrapper.java:264)
at com.ibm.ejs.j2c.ConnectionManager.initializeForUOW(ConnectionManager.java:776)
at com.ibm.ejs.j2c.ConnectionManager.involveMCInTran(ConnectionManager.java:622)
at com.ibm.ejs.j2c.ConnectionManager.associateConnection(ConnectionManager.java:1150)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.reactivate(WSJdbcConnection.java:1508)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.getTransactionIsolation(WSJdbcConnection.java:1079)
at com.savvion.sbm.util.SBMDAOService.closeConnection(SBMDAOService.java:169)
at com.savvion.sbm.util.SBMDAOService.clean(SBMDAOService.java:192)
at com.savvion.sbm.util.Sequence.createSequenceInDB(Sequence.java:169)
at com.savvion.sbm.util.Sequence.init(Sequence.java:114)
at com.savvion.sbm.util.Sequence.<init>(Sequence.java:91)
at com.savvion.sbm.bizlogic.util.BLUtil.initSequence(BLUtil.java:443)
at com.savvion.sbm.bizlogic.util.BLControl.start(BLControl.java:316)
at com.savvion.sbm.bizlogic.server.ejb.BLServerBean.start(BLServerBean.java:170)
at com.savvion.sbm.bizlogic.server.ejb.EJSRemoteStatelessBLServerBean_e586166b.start(Unknown Source)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie.start(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:504)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie._invoke(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:97)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:582)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:437)
at com.ibm.rmi.iiop.ORB.process(ORB.java:320)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1544)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2063)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
[1/13/03 11:59:50:089 IST] 24a85565 ExceptionUtil E CNTR0020E: Non-application exception occurred while processing method "start" on bean "BeanId(bizlogic#bizlogic.jar#BLServerBean, null)". Exception data: javax.ejb.EJBException: BizLogic startup failed: (5006):BizLogic Server Sequence initialization failed during server startup.; context(BLUtil.initSequence)DSRA9002E: ResourceException with error code null: javax.resource.ResourceException: enlist: caught Exception
at com.ibm.ejs.j2c.XATransactionWrapper.enlist(XATransactionWrapper.java:699)
at com.ibm.ejs.j2c.ConnectionEventListener.interactionPending(ConnectionEventListener.java:696)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processInteractionPendingEvent(WSRdbManagedConnectionImpl.java:1132)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.beginTransactionIfNecessary(WSJdbcConnection.java:429)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.createStatementCommon(WSJdbcConnection.java:736)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.createStatement(WSJdbcConnection.java:697)
at com.savvion.sbm.util.Sequence.createSequenceInDB(Sequence.java:137)
at com.savvion.sbm.util.Sequence.init(Sequence.java:114)
at com.savvion.sbm.util.Sequence.<init>(Sequence.java:91)
at com.savvion.sbm.bizlogic.util.BLUtil.initSequence(BLUtil.java:443)
at com.savvion.sbm.bizlogic.util.BLControl.start(BLControl.java:316)
at com.savvion.sbm.bizlogic.server.ejb.BLServerBean.start(BLServerBean.java:170)
at com.savvion.sbm.bizlogic.server.ejb.EJSRemoteStatelessBLServerBean_e586166b.start(Unknown Source)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie.start(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:504)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie._invoke(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:97)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:582)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:437)
at com.ibm.rmi.iiop.ORB.process(ORB.java:320)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1544)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2063)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
-------- chained exception -------
javax.transaction.SystemException: Failed to start the transaction association.
at com.ibm.ejs.jts.jta.TransactionImpl.enlistResource(TransactionImpl.java:757)
at com.ibm.ejs.jts.jta.JTSXA.enlist(JTSXA.java:998)
at com.ibm.ejs.j2c.XATransactionWrapper.enlist(XATransactionWrapper.java:598)
at com.ibm.ejs.j2c.ConnectionEventListener.interactionPending(ConnectionEventListener.java:696)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processInteractionPendingEvent(WSRdbManagedConnectionImpl.java:1132)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.beginTransactionIfNecessary(WSJdbcConnection.java:429)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.createStatementCommon(WSJdbcConnection.java:736)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.createStatement(WSJdbcConnection.java:697)
at com.savvion.sbm.util.Sequence.createSequenceInDB(Sequence.java:137)
at com.savvion.sbm.util.Sequence.init(Sequence.java:114)
at com.savvion.sbm.util.Sequence.<init>(Sequence.java:91)
at com.savvion.sbm.bizlogic.util.BLUtil.initSequence(BLUtil.java:443)
at com.savvion.sbm.bizlogic.util.BLControl.start(BLControl.java:316)
at com.savvion.sbm.bizlogic.server.ejb.BLServerBean.start(BLServerBean.java:170)
at com.savvion.sbm.bizlogic.server.ejb.EJSRemoteStatelessBLServerBean_e586166b.start(Unknown Source)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie.start(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:504)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie._invoke(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:97)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:582)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:437)
at com.ibm.rmi.iiop.ORB.process(ORB.java:320)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1544)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2063)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
at com.savvion.sbm.bizlogic.server.ejb.BLServerBean.start(BLServerBean.java:172)
at com.savvion.sbm.bizlogic.server.ejb.EJSRemoteStatelessBLServerBean_e586166b.start(Unknown Source)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie.start(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:504)
at com.savvion.sbm.bizlogic.server.ejb._EJSRemoteStatelessBLServerBean_e586166b_Tie._invoke(_EJSRemoteStatelessBLServerBean_e586166b_Tie.java:97)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:582)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:437)
at com.ibm.rmi.iiop.ORB.process(ORB.java:320)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1544)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2063)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
OK, Just out of curiosity, when you create the QueueSession, did you set the "transacted" parameter to "true"? It appears that it's not enlisting you JMS QCF for some reason, and that's the first possibility that jumps to mind.
Kyle
Subhash Namboodiri
Ranch Hand

Joined: Jan 02, 2003
Posts: 30
Hi Kyle,
The "transacted" parameter is false, when the QueueSession is created.
Also looking at the error is it not that the enlisting problem is occuring with the DataSource rather than the JMS QCF. Actually the code flow has not passed the database section, the JMS part comes once the database activities are completed succesfully.
Other than creating a dataSource from a JDBC provider of XA type, do we have to explicitly do some other settings? Also in the case of JMS QCF other than selecting the check box "Enable XA", do we have to explicitly do some other settings? Just want to confirm that my configurations are right.
Thanks in advance,
Subhash
[ January 13, 2003: Message edited by: Subhash Namboodiri ]
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
No, there's nothing else that I can think of... Could you post the code for the "createSequenceInDB" method? I wonder if anything is odd there...
Kyle
Subhash Namboodiri
Ranch Hand

Joined: Jan 02, 2003
Posts: 30
Hi Kyle,
I tried the same case with a simple SessionBean which is under container managed transaction. The bean has only one method start(). The method is not assigned any transaction attribute. The activities I am doing in the method are listed below:
1. Context context = new InitialContext();
2. javax.sql.DataSource ds = (javax.sql.DataSource)context.lookup("jdbc/BizLogicDB");
3. java.sql.Connection con = ds.getConnection("subhash", "subhash");
4. java.sql.Statement stmt = con.createStatement();
5. stmt.executeUpdate("insert into TestTable (name, age) values ('subhash', 29)");
6. TopicConnectionFactory factory = (TopicConnectionFactory)context.lookup("jms/TopicConnectionFactory");
7. TopicConnection jmsconn = factory.createTopicConnection();
8. TopicSession jmsses = jmsconn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
9. Message jmsg = jmsses.createTextMessage("Sample WebSphere Topic Example");
10. Topic topic = (Topic)context.lookup("jms/SBMTopic");
11. TopicPublisher publisher = jmsses.createPublisher(topic);
12. publisher.publish(jmsg);
In this if transaction is "Bean managed" and both the datasources are of Non-XA type it works properly, but if the transaction type is container managed and both the resources are XA type then the same errors keep coming.
If it is fine with you I can mail you the ear and the code to you so that you can even look into the deployment descriptors also. In that case please give me your id. My id is subhash@savvion.com
Thanks in advance,
Subhash
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
I would need to see your configuration files for your Websphere instance as well -- I'd like to see what you've done in setting up the XA and non-XA resources.
Send me a private message and I'll respond back with my email ID.
Kyle
Brad Reidell
Greenhorn

Joined: Jan 04, 2005
Posts: 1
Originally posted by Kyle Brown:
I would need to see your configuration files for your Websphere instance as well -- I'd like to see what you've done in setting up the XA and non-XA resources.

Send me a private message and I'll respond back with my email ID.

Kyle


Kyle - Is it possible you recal the solution to this? I am having the same issue. Thanks, Bret
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transaction related problem while using multiple resource in WebSphere