I need to make transational some EJB invocations.
I'm using Weblogic 5.1.
UserTransaction tx = (UserTransaction)ejb.getContext().lookup("javax.transaction.UserTransaction");
What I get when I try to instantiate tx object is a
I tried to investigate on tx'class and it's indeed a
How can it be that this code works in some parts of my code and here doesn't work?? it depends on the content of Context
in that moment??
Any clue will be highly appreciated!
Why don't you use context.getUserTransaction(), where context is the Session- or EntityContext of your EJB?
I'm afraid I can only use JNDI If I want to create an UserTransaction on the client side.....please correct me If I'm wrong.
Aarrgh!!! I found it out!
I have to import
a NOT this!!
importing the latter will cause the ClassCastException
Did u get the solution?? If not contact me at chandu at realprompt dot com
If you are starting the transaction from a JSP or servlet, use:
Context initCtx = new InitialContext();
UserTransaction tx = (UserTransaction) initCtx.lookup("java:comp/UserTransaction");