Quoting Jack Wang <[EMAIL PROTECTED]>:
if things are working the way they should, when you call getTransaction on the
TM object that you get from the Bridge from within the service impl of your ws
it should return a non NULL tx object unless you invoked your ws without a
coordination ctx. Please look at test-suite1. It shows how to do this.
--dasarath
> --- Dasarath Weeratunge <[EMAIL PROTECTED]>дµÀ:
> > keep on forgetting to send replies to the list...
> >
> > ----- Forwarded message from Dasarath Weeratunge <[EMAIL PROTECTED]>
> -----
> > Date: Sun, 12 Feb 2006 14:11:35 -0500
> > From: Dasarath Weeratunge <[EMAIL PROTECTED]>
> > Reply-To: Dasarath Weeratunge <[EMAIL PROTECTED]>
> > Subject: Re: MySQL's XA problem
> > To: Jack Wang <[EMAIL PROTECTED]>
> >
> > Quoting Jack Wang <[EMAIL PROTECTED]>:
> >
> > >
> > > The java code (JOTM example):
> > > ========================================================
> > > UserTransaction ut = null;
> > > try{
> > > Context ctx = new InitialContext();
> > > MysqlXADataSource xaDs =
> > > (MysqlXADataSource)ctx.lookup("java:comp/env/jdbc/myXADB");
> > > ut = (UserTransaction)ctx.lookup("java:comp/env/UserTransaction");
> >
> > How did u obtain this UserTransaction Object? It should come from the
> Geronimo
> > TM object instantiated by Bridge.
> >
>
> Hi, Dasarath. Thanks you. I come back.
>
> This UserTransaction Object is obtained from Tomcat 5.5 in which I have
> configured
> UserTransaction with JOTM . In the non ws environment, the ut controls the db
> operation correctly
> with ut.rollback() or ut.commit(), i.e. Now I can do XA operation in a jsp or
> a java bean.
>
> Current situation is that I can get the not null local tm, but the local
> tx is null from this
> tm regardless I use JOTM's tm or Bridge's tm. So I can not enlist the
> XAResource to the tx. So in
> the ws environment, I can call the ws by kandula, but the wstm.rollback() did
> not effect on the ws
> side's database.
>
> So how can I get the correct tx to enlist the XAResource ?
>
> p.s. After I get the XADataSource, I have set the tm to xaDs. If I commit
> the ut, the database
> will be effected though I use wstm.rollback() in the client side.
> -----------------------------------------------
> // Get tx
> TransactionManager tm = jotm.getTransactionManager();
> //or
> TransactionManager tm = o.a.k.g.Bridge.getInstance().getTM();
> javax.transaction.Transaction tx = tm.getTransaction(); <== NULL, Ooops
>
> // Get xaRes
> XADataSource xaDs = (XADataSource)ctx.lookup("java:comp/env/jdbc/myXADB");
> // tm <--> xaDs
> ((StandardXADataSource)xaDs).setTransactionManager(tm);
> XAConnection xCon = xaDs.getXAConnection("root", "password");
> XAResource xRes = xCon.getXAResource();
>
> // Here should add tx.enlistResource(xRes), but tx is null
>
> // Following is the db operation ...
> java.sql.Connection conn = xCon.getConnection();
> -----------------------------------------------
>
> >
> >
> > Here we go once again. Please don't commit the tx in your code. The tx will
> be
> > started and commited when you terminate your distributed (ws-at) tx using
> wa-at
> > Completion protocol. If you want to rollback your tx, you may do so
> however.
> > Even then it is better to mark the tx as "RollbackOnly".
> >
> > I will give u some steps later on.
> >
> > --dasarath
>
> Yes. So I should add try catch in the ws side. If exception occurs, in
> the server side, I
> should mark the ut setRollbackOnly(). Kandula will automatically detect this
> exception, and
> rollback the whole wsat. Is it right ?
>
>
>
>
>
>
> Wang Jun
>
>
>
>
>
>
> ___________________________________________________________
> ÑÅ»¢1GÃâ·ÑÓÊÏä°Ù·Ö°Ù·ÀÀ¬»øÐÅ
> http://cn.mail.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]