Hi,
I am getting NullPointer Exception, when i invoke UserTransaction from Stateless SessionBean in the line UserTransaction ut= ejbContext.getUserTransaction();
I have tried to use lookup for JNDI also as lookup(java:comp/env/UserTransaction)
and this shows NameNotFound Exception:UserTransaction Not Bound Error.
Thanks in Advance
-
NullPointer Exception (6 messages)
- Posted by: priya rajesh
- Posted on: February 01 2006 09:48 EST
Threaded Messages (6)
- NullPointer Exception by shreenee josh on February 01 2006 12:27 EST
- Getting Null Pointer when invoking the User Transaction Object by priya rajesh on February 01 2006 23:41 EST
-
Getting Null Pointer when invoking the User Transaction Object by shreenee josh on February 04 2006 01:40 EST
-
Getting Null Pointer when invoking the User Transaction Object by priya rajesh on February 08 2006 11:32 EST
- Getting Null Pointer when invoking the User Transaction Object by priya rajesh on February 09 2006 11:55 EST
-
Getting Null Pointer when invoking the User Transaction Object by priya rajesh on February 08 2006 11:32 EST
-
Getting Null Pointer when invoking the User Transaction Object by shreenee josh on February 04 2006 01:40 EST
- Getting Null Pointer when invoking the User Transaction Object by priya rajesh on February 01 2006 23:41 EST
- Hi by Dreamer X on February 05 2006 04:46 EST
-
NullPointer Exception[ Go to top ]
- Posted by: shreenee josh
- Posted on: February 01 2006 12:27 EST
- in response to priya rajesh
Hi Priya,
Whats the transaction attribute set in deployment descriptor ?
If it is "container" then UT will be null all the time.
cheers,
shrini -
Getting Null Pointer when invoking the User Transaction Object[ Go to top ]
- Posted by: priya rajesh
- Posted on: February 01 2006 23:41 EST
- in response to shreenee josh
Hi,
Thanks for the response. Actually, I am using CMP for the same and the attribute specified in the descriptor is "Required". I am presently trying the deployment in JBOSS 4.0.1SP1. I am actually invoking the UserTransaction in the stateless Session bean using the EJBContext. I got the same exception(NULL Pointer). Now if I change the same to SessionContext, I was getting "CMT not allowed to get into UserTransaction". I have never used the same with JBOSS. I have not registered any JNDI for UserTransaction as we do it for weblogic. Please do specify so as to how to go about. I have seen the console(jmx-console) yesterday and found the user transaction manager entry also which is running.
If I change the code to the below stated one it will give "Name Not Found Exception- user transaction not bound"
--------------------------------------------------------
The Code fragment
Context ic = new InitialContext();
String userTxURL = "java:comp/env/UserTransaction";
UserTransaction ut = (UserTransaction) ic.lookup(userTxURL);
-------------------------------------------------
How to go about with userTransaction with CMP. -
Getting Null Pointer when invoking the User Transaction Object[ Go to top ]
- Posted by: shreenee josh
- Posted on: February 04 2006 13:40 EST
- in response to priya rajesh
Hi Priya,
As you said you are using CMP, then I wish to know why do you need UT ?
Rules:
Trans = Container -- No UT is available, Container manages evrything. To rollback use setRollbackOnly() method on ejb context.
Trans = Bean --> UT is available and MUST be obtained from ejb context object by calling getUserTransaction().
Did I answer your que ?
shrini -
Getting Null Pointer when invoking the User Transaction Object[ Go to top ]
- Posted by: priya rajesh
- Posted on: February 08 2006 23:32 EST
- in response to shreenee josh
Hi,
Thanks for Response.I got it.Now i am trying for BMP,In this case also i am getting the same error when i invoke UT with ejbcontext object.I am invoking this from stateless session Bean.I think,i may missed out something in UT.could u pls tell me abt it. -
Getting Null Pointer when invoking the User Transaction Object[ Go to top ]
- Posted by: priya rajesh
- Posted on: February 09 2006 23:55 EST
- in response to priya rajesh
Hi
I have corrected it.Thanks. -
Hi[ Go to top ]
- Posted by: Dreamer X
- Posted on: February 05 2006 04:46 EST
- in response to priya rajesh
container manage or bean manage?
if container manage of course you will get a error.And you used CMP? Why UT additional?