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?
Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
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.