Hey everyone, I'm pretty new to the whole EJB world so please forgive me if this questions has been asked and answered before.
Here is my current situation. I have a Web Application that is accessing a Session Bean, my session bean is then accessing my local entity bean. I'm getting errors everytime I try to do the lookup to the entity bean from the Session Bean. Here is my code.
javax.naming.Context ctx = new javax.naming.InitialContext();
Object obj = ctx.lookup("java:comp/env/ejb/PersonData");
PersonDataLocalHome personHome = (PersonDataLocalHome)obj;
PersonDataLocal person = personHome.create(lName);
I've tried every diffent lookup name I can think of but I'm getting an error every time the .lookup executes.
This is the error I'm getting.
javax.naming.NameNotFoundException: Name comp/env/ejb not found in context "java:".
Thanks for any help anyone can offer.
Thank You
-
Accessing Local Entity Bean From Session Bean (4 messages)
- Posted by: Omikron Theta
- Posted on: August 02 2004 09:32 EDT
Threaded Messages (4)
- Accessing Local Entity Bean From Session Bean by Rene Zanner on August 02 2004 11:12 EDT
- I'm using WebSphere by Omikron Theta on August 02 2004 11:48 EDT
- Help by Omikron Theta on August 02 2004 12:54 EDT
- Help by Mohit Gupta on August 03 2004 03:46 EDT
- Help by Omikron Theta on August 02 2004 12:54 EDT
-
Accessing Local Entity Bean From Session Bean[ Go to top ]
- Posted by: Rene Zanner
- Posted on: August 02 2004 11:12 EDT
- in response to Omikron Theta
Hi,
try to explore the JNDI tree of your EJB server (every server has that kind of management feature in it's console). There you should see the homes bound to their JNDI names. Compare those JNDI names from the running system with the name you are using for your lookup. Match them!
Cheers,
René Zanner -
I'm using WebSphere[ Go to top ]
- Posted by: Omikron Theta
- Posted on: August 02 2004 11:48 EDT
- in response to Omikron Theta
The Deployment Descriptior editor lists the JNDI name for that bean as,
ejb/geff/caruso/ejb/PersonDataLocalHome
but when I use that I get the same error. Is there something else I need to do to make a local lookup work? -
Help[ Go to top ]
- Posted by: Omikron Theta
- Posted on: August 02 2004 12:54 EDT
- in response to Omikron Theta
I've even used WebSphere's wizard to insert the lookup code for me and its still throwing the same error. This is starting to get on my nerves. -
Help[ Go to top ]
- Posted by: Mohit Gupta
- Posted on: August 03 2004 03:46 EDT
- in response to Omikron Theta
Hi Omikron,
I was also facing the same problem when i was using jndi name to look up on Websphere 5.1.1 but it get resolved when i use the ejb reference name for a look up . I got an idea of jndi ejb references lookup from Mastering EJB by ED Roman.
You can check your deployment descriptor once again might be there are some problems in naming of ejb reference.
Mohit