wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes JNDI relativity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "JNDI relativity" Watch "JNDI relativity" New topic
Author

JNDI relativity

Kai Witte
Ranch Hand

Joined: Jul 17, 2004
Posts: 356
hello,

the name tags of <env-entry>, <ejb-ref>, <ejb-local-ref>, <resource-ref>, <resource-env-ref> are all relative to java:comp/env, right?

So <env-entry-name>Test</env-entry-name> would be looked up for example this way:


Now if i would use <env-entry-name>/Test</env-entry-name> would the name be absolute and the lookup be c.lookup("Test")? Can I also use c.lookup("/Test") in that case?

Are there other ways regarding the relativity of the naming that I should be aware of for the exam?

Kai


Kai Witte's business website Kai Witte's private homepage
seemapanth Joshi
Ranch Hand

Joined: Nov 28, 2004
Posts: 47
I am attempting to answer because I want to understand. Now what is it you are asking when you say

Now if i would use <env-entry-name>/Test</env-entry-name> would the name be absolute and the lookup be c.lookup("Test")? Can I also use c.lookup("/Test") in that case?

From what I understand from the specs is that these environment entries are stored in JNDI contexts and when we say lookup you need to give the entire path of the JNDI context. You can at the most save the subcontext and then directly say lookup as illustrated in the example given in spec excerpted here:

where maxExemptions would be declared as:

Spec page 411.

Though I have not tried it but I guess saying <env-entry-name>/Test</env-entry-name> would be wrong or not achieve anything because it would be looking for "java:comp/env/Test" and would not find it.

Am I right?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI relativity
 
Similar Threads
DataSource JNDI name
Difference between resource-ref and env-entry
Topic: access remote session ejb on remote server
getInitParameter with a MessageDrivenBean
Lookup strings question