Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java:comp/env - vs. - Global JNDI lookup - What is the difference?

 
Anirudh Gupta
Ranch Hand
Posts: 49
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
O'Reily EJB 3.1, Chapter 18 - Interceptors, Section Custom Injection Annotations.

The EJB specification has a bunch of annotations for injecting Java EE resources, services, and EJB references into
your bean classes. Some application servers or applications like to use JNDI as a global registry for configuration or for
non-Java EE services. Unfortunately, the specification defines no way to inject something directly from global JNDI into your beans.


With respect to the above statement(s) I had a train of thoughts which led me to the question,

What is the fundamental difference between "java:/comp/env" and "Global JNDI". Aren't they both contexts within the same JVM?
How are they different?


I realize that "Global JNDI" could be anything(as in any context) and I have purposely left it undefined in the question here. I am of course
referring to EJB lookup and resource lookup. The other question in my mind is,

Can I lookup one bean from another by using the "java:comp/env" context? What are the various conditions under which I can or cannot
do this?
 
Cosmin Nicolae Vacaroiu
Ranch Hand
Posts: 55
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"java:comp/env" is used mainly to do manual lookup on it. Each EJB has its own "java:comp/env".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic