my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes User Txn - Lookup problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "User Txn - Lookup problem" Watch "User Txn - Lookup problem" New topic
Author

User Txn - Lookup problem

Shivaji Bhosale
Ranch Hand

Joined: Mar 12, 2001
Posts: 70
From my simple Java Class client, I want to initiate User Txn. Server CMPs have Txn attributes as TX_REQUIRED.
Say I am carrying out 5 Txns, & say 3rd one is failed, then previous 2 must be rolled back & next Txns must be abandoned.
Since my client is not a Session Bean, I have code like this, for having UserTransaction.
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, factory);
ht.put(Context.PROVIDER_URL, url);
InitialContext ctx = new InitialContext(ht);
javax.transaction.UserTransaction userTrans =
(javax.transaction.UserTransaction)ctx.lookup("javax.transaction.UserTransaction");
But at this lookup I get an error NoSuchNameFoundException.
Right now I am doing this all in IBM VAJ which is having Websphere Test Environment. I have Name Server & Bean Servers running.
What is the problem? If URL is wrong ?
Waiting eagerly for replies...
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
The JNDI name isn't right. Lookup "jta/usertransaction" instead.

Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.


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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: User Txn - Lookup problem