Ok, I cut the piece for getting the TA: it's this:
public static UserTransaction getTransaction ()
{
initContext ();
UserTransaction ta = null;
if (jndiContext != null) {
try {
ta = (UserTransaction)jndiContext.lookup("UserTransaction");
}
catch (javax.naming.NamingException e) {
log.error("Exception while getting a transaction. Exception: ",
e);
}
}
return ta;
}
...and it's fore sure a different VM. What's funny is, that only the last
value got lost...
-----Original Message-----
From: Ole Husgaard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 19, 2001 5:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] UserTransaction from client side
Hi,
Not sure if you lookup the UT correctly.
Please be aware that the current stand-alone
client UT _only_ works correctly if the client
executes in a VM other than the server VM.
There is a UT test in the CTS tests in the
jbosstest test suite.
That may be useful as a starting point.
Best Regards,
Ole Husgaard.
Lutz Hilken wrote:
>
> Hi,
>
> I want to use Client-controlled transactions by using UserTransaction.
When
> testing it, some problems occured. See this code:
>
> UserTransaction ta = null;
> try {
> String key = null;
> MyBean b = null;
> ta = EJBUtil.getTransaction ();
> ta.setTransactionTimeout(5) ;
> ta.begin ();
> MyBeanHome home = (MyBeanHome)EJBUtil.findHome ("MyBean");
> boolean doRollback = args[0].equals("x");
> for (int i = 1; i<args.length; i++) {
> key = args[i];
> b = loadOrCreateMyBean (home, key);
> b.setValue ("Some vaule..."+key);
> log.info ("Value is: "+b.getValue());
> }
> if (doRollback) {
> ta.rollback();
> }
> else {
> ta.commit ();
> }
> }
> catch (Exception ex) {
> log.error ("...Ooops", ex);
> try {
> ta.rollback();
> }
> catch (Exception rex) {
> log.error ("ROLLBACK failed!", rex);
> }
> }
>
> Now, when calling the code the first time, the objects are created, at
least
> they are complete in JBoss memory cache, BUT the value of the last created
> bean is not present in the database!
> The second call to this code, using the same keys updating the beans,
hangs
> in the commit() call and does not return, allthough the timeout is set to
5
> secs (I got a trace message on the server console, but the client keeps
> hanging).
>
> What's wrong?
>
> I'm using JBoss 2.4.0, CMP for the beans, no specific
Transaction-attribute
> (so all are Required) and Oracle.
>
> So, please help, we need this feature urgently....
>
> Thanks, Lutz.
>
> Lutz Hilken
> IT-Consult
> IVU Traffic Technologies AG
> Bundesallee 88, D-12161 Berlin
> Telefon: +49.30.85 906-450, Telefax: +49.30.85 906-499
> [EMAIL PROTECTED], www.ivu.de
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user