• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNDI Concepts

 
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nowadays I am studying jndi in detail. I have used JNDI to browse my local file system. What I read about JNDI is that it maintains hierarchical tree like structure, where there is a root context, which may contain one or more sub-context and so on. Also when we write the code in an EJB. What app server does is initializes JNDI with proper drivers,
InitialContext ctx = new InitialContext();


Now my question starts here
I tried following code in my EJB

It prints �localhost/nodes/localhost/servers/server1� (I am using WSAD 5.0 to run this code).

Again when I try

I get javax.naming.NameNotFoundException: localhost/nodes/localhost/servers/server1�

Why is this happening? Also is it possible to parse whole JNDI Tree? If Yes how?
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you should start enumerating things from the initial context. I don't think you need to include the initial context's real name when you try and enumerate its contents, as it thinks you are trying to enumerate "localhost/nodes/localhost/servers/server1/localhost/nodes/localhost/servers/server1" possibly.
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thnaks Nathaniel,
but InitialContext class doesn't have any list() method with empty parameters. So i need to provide name of the initial context.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah .. good point. You don't need the prepended "/" or "java:/" ?
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks it worked if i pass empty string
 
reply
    Bookmark Topic Watch Topic
  • New Topic