Search code examples
javatomcattomcat7jndi

JNDI configuration in Tomcat


I am trying to set up JNDI lookup in web application to be deployed in Tomcat 7. I have specified following properties in jndi.properties file:

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces, java.naming.provider.url=localhost:1199

But when i get initial context and inspecting its attributes it reveals that java.naming.factory.initial changes to org.apache.naming.java.JavaURLContextFactory and all other properties remains same as in the jndi.properties file.I dont understand why this single property gets changes ? How can i prevent this and force tomcat to use property i have specified ?


Solution

  • I believe the JNDI properties should be vendor specific, What you trying to put is for Jboss JNDI properties, and may have been reverting to for Tomcat Specific Proerties. Although you can try to overwrite them programatically, it might not work properly.