File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes why java:comp/env Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "why java:comp/env" Watch "why java:comp/env" New topic
Author

why java:comp/env

ajse ruku
Ranch Hand

Joined: May 06, 2005
Posts: 193
Hi,
I have tried to underdstand by googling why we need to prefix "java:comp/env" with JNDI name every time we lookup,but still i am not very sure about this.
Can someone please explain this in simple terms so that a new guy in the JAVA world can understand.

thanks,
Ajse
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What that is is called the environment-naming context (or ENC for short). This is used to provide a reference to a resource in JNDI that is constant, regardless of where it is in JNDI. Different containers can bind resources in different places in the JNDI namespace, and the ENC is used to provide a reference to that position.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: why java:comp/env
 
Similar Threads
database connection from JNDI
About accessing EJB
Naming Not Found Exception
Finding resources
JNDI local context