All I know regarding JNDI lookup is that JNDI API needs a Java EE (servlet/EJB) container to work.
So if you try to use JNDI API in Java SE apps, it will not work. One way to get this to work is to call some API in your container to retrieve the JNDI information if that's what you need. However, this isn't a best practice.
Setting up JNDI registry like DB connection or whatever is done through XML configuration in Tomcat or JBoss/Glassfish etc
K. Tsang OCPJP OCMJEA SOACP PMP
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad: