Reputation:
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 ?
Upvotes: 5
Views: 5596
Reputation: 1
I think you should append your properties to your catalina.properties file,it's under your $tomcat_home/conf.
Upvotes: 0
Reputation: 310850
You should put all this stuff into a Resource element in your META-INF/context.xml file, and look up that resource via a java:comp/env URL. That's what Tomcat is trying to set up here: an object factory for that namespace.
Upvotes: 0
Reputation: 9405
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.
Upvotes: 2