• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

JNDI relativity

 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic