[jboss-user] [JNDI and Naming] - Re: JNDI binding and NameNotFoundException

David Bailey do-not-reply at jboss.com
Wed Dec 14 10:11:33 EST 2011

David Bailey [http://community.jboss.org/people/edwardpig] created the discussion

"Re: JNDI binding and NameNotFoundException"

To view the discussion, visit: http://community.jboss.org/message/641557#641557

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111214/8fbfd8f1/attachment.html 

More information about the jboss-user mailing list