Originally posted by Valentin Tanase:
One way is to use application resource files. Having a file named jndi.properties that defines all properties required to build the initial context will help achieving the location transparency. This file must be located in the application's classpath or it might be located under the $JAVA_HOME/lib folder. Another way is to use an IoC container like PicoContainer or Spring framework that does that job for you.
Regards.
Hi,
I tried this and it is working fine. By doing this way I can say that the client don't require to hardcode the "provider_url" in the code to get the initial context.
Now it brings me another question. In the jndi.properties file you are mentioning the Provider URL to locate the context. Fine, If that is the case how will you say that it is location transparent to the client since the client knows the Provider URL in his $java_home/lib folder. Also whether the client can able to speak with two different context at the same time?