JBoss Community

Re: JNDI binding and NameNotFoundException

created by David Bailey in JNDI and Naming - View the full discussion

Okay, I finally got it figured out.  There were two missing pieces when I originally posted this 2 days ago.

 

One, I didn't know I needed to package my bean classes in a separate jar and declare it in my application.xml.  So thanks to Wolf-Dieter for that bit of information.

 

Two, when attempting to access the bean from my code, I was using InitialContext.lookup() and supplying a string of "<ear-name>/<bean-name>/local".  I didn't realize that I had to supply the full ear file name, including the version.  That seems a bit klunky to me, to hard-code a version ID in my Java code.  But once I got past the first hurdle of declaring my EJB jar file in the application XML, I was able to see the name JBoss was using to bind my bean to JNDI, and I saw that indeed the version ID was there.

 

So once I specified the JNDI name correctly, everything worked.  Thanks.

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community