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.
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!
The Deployment Descriptior editor lists the JNDI name for that bean as,
but when I use that I get the same error. Is there something else I need to do to make a local lookup work?
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.
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.