Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CMP and BMP mix within a Transaction

8 views
Skip to first unread message

Philip Sanders

unread,
Jan 16, 2001, 12:19:17 PM1/16/01
to
I am having a problem using a CMP and BMP bean in the same transaction.
The basic flow is

Client->Session Bean
->Session Bean-> Query BMP
->Create a CMP Bean
->Set fields in CMP Bean
Return

The transaction fails and deep within websphere I see this exception

[01.01.16 09:59:13:895 CST] 532f5734 OnePhaseConne E Mismatched Xid
javax.transaction.xa.XAException
at java.lang.Throwable.<init>(Throwable.java:84)
at java.lang.Exception.<init>(Exception.java:35)
at javax.transaction.xa.XAException.<init>(XAException.java:61)
at
com.ibm.ejs.cm.pool.OnePhaseConnectO.prepare(OnePhaseConnectO.java:120)
at
com.ibm.ejs.jts.jta.onephase.OnePhaseResourceImpl.prepare(OnePhaseResourceImpl.java:165)
at
com.ibm.ejs.jts.jts.ResourceVector.deliverPrepare(ResourceVector.java:206)
at
com.ibm.ejs.jts.jts.ResourceVector.beforePrepare(ResourceVector.java:183)
at
com.ibm.ejs.jts.tran.EventCallback.executeCallback(EventCallback.java:161)
at
com.ibm.ejs.jts.tran.EventCallback.executeCallbackTree(EventCallback.java:132)
at
com.ibm.ejs.jts.tran.EventCallback.executeCallbackTree(EventCallback.java:123)
at
com.ibm.ejs.jts.tran.EventPrepare.ExecuteBeforePrepareCallbacks(EventPrepare.java:298)
at
com.ibm.ejs.jts.tran.EventPrepare.event_LocalPrepareWork(EventPrepare.java:273)
at
com.ibm.ejs.jts.tran.EventPrepare.event_BecomeCoordinator(EventPrepare.java(Compiled
Code))
at
com.ibm.ejs.jts.tran.EventControl.event_EndTopLevel(EventControl.java(Compiled
Code))
at com.ibm.ejs.jts.tran.TrecInterface.end(TrecInterface.java:88)
at com.ibm.ejs.jts.jts.TerminatorImpl.commit(TerminatorImpl.java:89)
at com.ibm.ejs.jts.jts.CurrentImpl.commit(CurrentImpl.java:192)
at com.ibm.ejs.jts.jts.CurrentSet.commit(CurrentSet.java:264)
at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:181)
at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:59)
at
com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:405)
at
com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:1637)
at
com.ibm.wsbc.ac.probmgmt.EJSRemoteUser.openProblem(EJSRemoteUser.java:43)
at
com.ibm.wsbc.ac.probmgmt._EJSRemoteUser_Tie._invoke(_EJSRemoteUser_Tie.java:126)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(Unknown Source)
at com.ibm.CORBA.iiop.ORB.process(Unknown Source)
at com.ibm.CORBA.iiop.WorkerThread.run(Unknown Source)
at com.ibm.ejs.oa.pool.ThreadPool$PooledThread.run(ThreadPool.java:532)

[01.01.16 09:59:13:955 CST] 532f5734 ResourceVecto E Prepare failure:
org.omg.CORBA.INTERNAL: XAException
caught due to connection prepare error. minor code: 0 completed: No
at java.lang.RuntimeException.<init>(RuntimeException.java:49)
at org.omg.CORBA.SystemException.<init>(SystemException.java:51)
at org.omg.CORBA.INTERNAL.<init>(INTERNAL.java:76)
at org.omg.CORBA.INTERNAL.<init>(INTERNAL.java:50)
at
com.ibm.ejs.jts.jta.onephase.OnePhaseResourceImpl.prepare(OnePhaseResourceImpl.java:168)
at
com.ibm.ejs.jts.jts.ResourceVector.deliverPrepare(ResourceVector.java:206)
at
com.ibm.ejs.jts.jts.ResourceVector.beforePrepare(ResourceVector.java:183)
at
com.ibm.ejs.jts.tran.EventCallback.executeCallback(EventCallback.java:161)
at
com.ibm.ejs.jts.tran.EventCallback.executeCallbackTree(EventCallback.java:132)
at
com.ibm.ejs.jts.tran.EventCallback.executeCallbackTree(EventCallback.java:123)
at
com.ibm.ejs.jts.tran.EventPrepare.ExecuteBeforePrepareCallbacks(EventPrepare.java:298)
at
com.ibm.ejs.jts.tran.EventPrepare.event_LocalPrepareWork(EventPrepare.java:273)
at
com.ibm.ejs.jts.tran.EventPrepare.event_BecomeCoordinator(EventPrepare.java(Compiled
Code))
at
com.ibm.ejs.jts.tran.EventControl.event_EndTopLevel(EventControl.java(Compiled
Code))
at com.ibm.ejs.jts.tran.TrecInterface.end(TrecInterface.java:88)
at com.ibm.ejs.jts.jts.TerminatorImpl.commit(TerminatorImpl.java:89)
at com.ibm.ejs.jts.jts.CurrentImpl.commit(CurrentImpl.java:192)
at com.ibm.ejs.jts.jts.CurrentSet.commit(CurrentSet.java:264)
at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:181)
at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:59)
at
com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:405)
at
com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:1637)
at
com.ibm.wsbc.ac.probmgmt.EJSRemoteUser.openProblem(EJSRemoteUser.java:43)
at
com.ibm.wsbc.ac.probmgmt._EJSRemoteUser_Tie._invoke(_EJSRemoteUser_Tie.java:126)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(Unknown Source)
at com.ibm.CORBA.iiop.ORB.process(Unknown Source)
at com.ibm.CORBA.iiop.WorkerThread.run(Unknown Source)
at com.ibm.ejs.oa.pool.ThreadPool$PooledThread.run(ThreadPool.java:532)


Any idea where to look for problems? I can comment out the BMP call path
and the CMP works. And likewise, I can comment out the CMP call path and
the BMP path works, i.e. no transaction rollback problems.

Squid

unread,
Jan 16, 2001, 4:15:08 PM1/16/01
to
How do you get the database connection in your BMP?

-Squid

"Philip Sanders" <ppj...@us.ibm.com> wrote in message
news:3A648295...@us.ibm.com...

Philip Sanders

unread,
Jan 17, 2001, 9:17:46 AM1/17/01
to
Squid wrote:
>
> How do you get the database connection in your BMP?
>
> -Squid
>

From the looks of it (it's not my code), they lookup the datasource in
the JNDI and then do a getConnection() with no parameters on that
datasource. If it makes a difference, this is a different datasource
than the CMP bean's that I have.

Raman Venkataraman

unread,
Jan 17, 2001, 1:31:16 PM1/17/01
to
If you are testing within VAJ 3.5+, you maybe interested in the following.
-Raman

( This is from the VAJ_enterprise news group )


Hi,
we had also the problem that when using 2 EJB servers
we got a CSITransactionRollbackException.
We spend a couple of time to recognize that the DB/2 Driver
(the JTA) feature had not been set correctly.
If you use DB/2 6.1 with Fix 4 you need to call
the usejdbc2.bat file. After that you have to set the JTA flag to true.

Kai Bartheidel
IT Services and Solutions
IBM Global Services


Bodo =?iso-8859-1?Q?Wei=DF?= <bodo....@sercon.de> wrote:
>We have a problem with the EJB Test Environment of VAJ3.5.
>A stateful session bean calls a primaryKey-finder on an entity
>bean. In the VAJ 3.5 Test Environment the session bean is
>added its own EJB server and the entity bean is added to another
>server. Both beans are in different EJB groups.
>If I start both server and run the test client I get
>an exception after the end of the method-call of the stateful session
>bean. Both beans work correct, but when the method
>of the stateful session bean is ended the container throws the
>exception at commit-time.
>
>If I add both beans to the same EJB server the whole test works fine.
>
>In VAJ 3.0.2 it was possible to spread beans over different servers. Why
>
>doesn't work this in VAJ 3.5?
>Has there changed something in the transaction-handling of the
>container?
>Or is it just a bug?
>
>Here's my piece of code (LookUp just works as a HomeFactory, this works
>fine):
> public void doTest() {
> try {
> BenutzerHome benutzerHome = (BenutzerHome)
>LookUp.getEJBHomeObjRef("Benutzer");
> Benutzer anwender = benutzerHome.findByPrimaryKey(new
>BenutzerKey(1));
> }
> catch (Exception e)
> {
> e.printStackTrace();
> }
> }
>
>Here are my Transaction-Properties for both beans::
>Transaction Attribute: TX_REQUIRED.
>Isolation-Level: TRANSACTION_SERIALIZABLE.
>The Session-Timeout ist set to 0 for the statefull session bean.
>Transaction-Timeout and Transaction inactivity timeout is set to
>standard.
>
>And here's the exception from the log:
>
>[00.09.27 11:25:10:323 GMT+02:00] 4f98 TranStrategy E Commit failed
> org.omg.CORBA.TRANSACTION_ROLLEDBACK:


>minor code: 0 completed: No

> java.lang.Throwable(java.lang.String)
> java.lang.Exception(java.lang.String)
> java.lang.RuntimeException(java.lang.String)
> org.omg.CORBA.SystemException(java.lang.String, int,
>org.omg.CORBA.CompletionStatus)
> org.omg.CORBA.TRANSACTION_ROLLEDBACK(java.lang.String, int,
>org.omg.CORBA.CompletionStatus)
> org.omg.CORBA.TRANSACTION_ROLLEDBACK(java.lang.String)
> org.omg.CORBA.TRANSACTION_ROLLEDBACK()
> void com.ibm.ejs.jts.jts.TerminatorImpl.commit(boolean)
> void com.ibm.ejs.jts.jts.CurrentImpl.commit(boolean)
> void com.ibm.ejs.jts.jts.CurrentSet.commit(boolean)
> void com.ibm.ejs.csi.TranStrategy.commit()
> void
>com.ibm.ejs.csi.TranStrategy.postInvoke(com.ibm.websphere.csi.EJBKey,
>com.ibm.ejs.csi.TxCookieImpl)
> void
>com.ibm.ejs.csi.TransactionControlImpl.postInvoke(com.ibm.websphere.csi.EJB
Key,
>
>com.ibm.websphere.csi.TxCookie, com.ibm.websphere.csi.ExceptionType)
> void
>com.ibm.ejs.container.EJSContainer.postInvoke(com.ibm.ejs.container.EJSWrap
per,
>
>int, com.ibm.ejs.container.EJSDeployedSupport)
> void de.kivi.ejb.sessionbean.EJSRemoteSessionFactory.doTest()
> org.omg.CORBA.portable.OutputStream
>de.kivi.ejb.sessionbean._EJSRemoteSessionFactory_Tie._invoke(java.lang.Stri
ng,
>
>org.omg.CORBA.portable.InputStream,
>org.omg.CORBA.portable.ResponseHandler)
> com.ibm.rmi.ServerResponse
>com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(com.ibm.rmi.ServerReques
t)
>
> com.ibm.rmi.ServerResponse
>com.ibm.CORBA.iiop.ORB.process(com.ibm.rmi.ServerRequest)
> void com.ibm.CORBA.iiop.WorkerThread.run()
> void com.ibm.ejs.oa.pool.ThreadPool$PooledThread.run()
>
>
>[00.09.27 11:25:10:413 GMT+02:00] 4f98 EJSContainer E postInvoke:
>transaction rollback in finally
>
>com.ibm.websphere.csi.CSITransactionRolledbackException:
> java.lang.Throwable(java.lang.String)
> java.lang.Exception(java.lang.String)
> java.io.IOException(java.lang.String)
> java.rmi.RemoteException(java.lang.String)
> com.ibm.websphere.csi.CSIException(java.lang.String)
> com.ibm.websphere.csi.CSITransactionRolledbackException(java.lang.String)
>
> void com.ibm.ejs.csi.TranStrategy.commit()
> void
>com.ibm.ejs.csi.TranStrategy.postInvoke(com.ibm.websphere.csi.EJBKey,
>com.ibm.ejs.csi.TxCookieImpl)
> void
>com.ibm.ejs.csi.TransactionControlImpl.postInvoke(com.ibm.websphere.csi.EJB
Key,
>
>com.ibm.websphere.csi.TxCookie, com.ibm.websphere.csi.ExceptionType)
> void
>com.ibm.ejs.container.EJSContainer.postInvoke(com.ibm.ejs.container.EJSWrap
per,
>
>int, com.ibm.ejs.container.EJSDeployedSupport)
> void de.kivi.ejb.sessionbean.EJSRemoteSessionFactory.doTest()
> org.omg.CORBA.portable.OutputStream
>de.kivi.ejb.sessionbean._EJSRemoteSessionFactory_Tie._invoke(java.lang.Stri
ng,
>
>org.omg.CORBA.portable.InputStream,
>org.omg.CORBA.portable.ResponseHandler)
> com.ibm.rmi.ServerResponse
>com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(com.ibm.rmi.ServerReques
t)
>
> com.ibm.rmi.ServerResponse
>com.ibm.CORBA.iiop.ORB.process(com.ibm.rmi.ServerRequest)
> void com.ibm.CORBA.iiop.WorkerThread.run()
> void com.ibm.ejs.oa.pool.ThreadPool$PooledThread.run()
>
>
>
>Any suggestions are welcome.
>
>Torsten Schulte / Bodo Weiss
>SerCon Dortmund
>Germany
>


"Philip Sanders" <ppj...@us.ibm.com> wrote in message
news:3A648295...@us.ibm.com...

com.ibm.ejs.jts.tran.EventCallback.executeCallbackTree(EventCallback.java:13
2)
> at
>
com.ibm.ejs.jts.tran.EventCallback.executeCallbackTree(EventCallback.java:12
3)
> at
>
com.ibm.ejs.jts.tran.EventPrepare.ExecuteBeforePrepareCallbacks(EventPrepare
.java:298)
> at
>
com.ibm.ejs.jts.tran.EventPrepare.event_LocalPrepareWork(EventPrepare.java:2
73)
> at
>
com.ibm.ejs.jts.tran.EventPrepare.event_BecomeCoordinator(EventPrepare.java(
Compiled
> Code))
> at
>
com.ibm.ejs.jts.tran.EventControl.event_EndTopLevel(EventControl.java(Compil
ed

com.ibm.ejs.jts.tran.EventCallback.executeCallbackTree(EventCallback.java:13
2)
> at
>
com.ibm.ejs.jts.tran.EventCallback.executeCallbackTree(EventCallback.java:12
3)
> at
>
com.ibm.ejs.jts.tran.EventPrepare.ExecuteBeforePrepareCallbacks(EventPrepare
.java:298)
> at
>
com.ibm.ejs.jts.tran.EventPrepare.event_LocalPrepareWork(EventPrepare.java:2
73)
> at
>
com.ibm.ejs.jts.tran.EventPrepare.event_BecomeCoordinator(EventPrepare.java(
Compiled
> Code))
> at
>
com.ibm.ejs.jts.tran.EventControl.event_EndTopLevel(EventControl.java(Compil
ed

> Code))
> at com.ibm.ejs.jts.tran.TrecInterface.end(TrecInterface.java:88)
> at com.ibm.ejs.jts.jts.TerminatorImpl.commit(TerminatorImpl.java:89)
> at com.ibm.ejs.jts.jts.CurrentImpl.commit(CurrentImpl.java:192)
> at com.ibm.ejs.jts.jts.CurrentSet.commit(CurrentSet.java:264)
> at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:181)
> at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:59)
> at
>
com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.jav

Squid

unread,
Jan 18, 2001, 4:44:31 PM1/18/01
to
Hmmm - a shot in the dark - try using the JTA-enabled version of the DB2
JDBC driver...

-Squid

"Philip Sanders" <ppj...@us.ibm.com> wrote in message

news:3A65A98A...@us.ibm.com...

Philip Sanders

unread,
Jan 19, 2001, 12:03:35 PM1/19/01
to
Squid wrote:
>
> Hmmm - a shot in the dark - try using the JTA-enabled version of the DB2
> JDBC driver...
>
> -Squid
>

All this talk about enabling JTA got me thinking about trying to put my
CMP bean in the same database as the BMP bean -- and what do you know --
everything now works. I still may go the JTA route just to verify (and I
think it is a very good chance that it will), but I am up and going for
the time being. Thanks for the tips

Paul Ilechko

unread,
Jan 19, 2001, 4:04:25 PM1/19/01
to

Philip Sanders wrote:

> All this talk about enabling JTA got me thinking about trying to put my
> CMP bean in the same database as the BMP bean -- and what do you know --
> everything now works. I still may go the JTA route just to verify (and I
> think it is a very good chance that it will), but I am up and going for
> the time being. Thanks for the tips

Well, if you'd told us you had two different databases ...

But you are right, you need JTA to do a heteregeneous transaction. The
non-JTA driver was trying to do a one-phase commit, which is illegal
across two databases.

pilechko.vcf
0 new messages