| Author |
java:comp/env - vs. - Global JNDI lookup - What is the difference?
|
Anirudh Gupta
Greenhorn
Joined: Dec 08, 2010
Posts: 20
|
|
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
Joined: Feb 10, 2011
Posts: 51
|
|
|
"java:comp/env" is used mainly to do manual lookup on it. Each EJB has its own "java:comp/env".
|
SCJP 6 (93%), SQL Expert 11g (95%), SCWCD 6 (84%), OCE-EJBD 6 (98%), OCE-JPAD 6 (93%)
|
 |
Herman Pomstra
Greenhorn
Joined: Aug 17, 2011
Posts: 7
|
|
|
Or look at: http://stackoverflow.com/questions/7458114/what-is-the-relationship-between-javacomp-env-and-javaglobal
|
 |
 |
|
|
subject: java:comp/env - vs. - Global JNDI lookup - What is the difference?
|
|
|