File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes NamingException during lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "NamingException during lookup" Watch "NamingException during lookup" New topic

NamingException during lookup

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10031


I have a scenario where in I"m doing a lookup for a Stateless session bean. This Stateless session bean extends an abstract class and in the abstract class i"m doing some DI on some resources using the @Resource annotation. Now what happens is, when I deploy this to my Weblogic, it goes off fine and when I try to access this SSB, I run into a NamingException. The JNDI path for the resource that I"m injecting in my abstract class is something like x.y.z.myAbstractClass#myAbstractClass and the JNDI name of the SSB is something like x.y.u.mySSB#mySSB. When I look at the stact trace, it says that unable to resolve x.y.u.mySSB#mySSB, resolved till x.y.

After having a look at this I started to think that this might be because of the DI which might have failed in the abstract class. But there is no way for me to check this. I tried seeing the JNDI tree but everytime I try to view it my system crashed and I really did not want to waste time on that. So ranchers is my guess correct? because I remember form the specs that if the DI fails then the bean instance is discarded. But does DI happens during deployment or during run time?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10031

Any thoughts on this guys?
Mark Garland
Ranch Hand

Joined: Nov 11, 2006
Posts: 226
Hi Jothi,

Good to see you again - I remember you from the SCWCD forum - did you ever take it and pass?

I'm very new to EJB, so here's my stab.

Could you do something like below from your client:

Then, iterate over the NamingEnumeration to list out everything it can see.

From that, you could tell if you bean was bound to JNDI correctly, and whether the name you were using was correct.

Just an idea...


28/06/06 - SCJP - 69%, 05/06/07 - SCWCD - 92%, 28/02/08 - IBM DB2 v9 Fundamentals (Exam 730) - 87%, 18/11/08 - IBM DB2 v9 DBA (Exam 731) - 89%, 26/02/11 - SCBCD - 88%
I agree. Here's the link:
subject: NamingException during lookup
It's not a secret anymore!