I've been running a web application on Tomcat, when I make some changes in the application, including context.xml, and redeploy it, I start receiving an exception:
javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
After looking around, I realise that the appname.xml in CATALINA_BASE/conf/Catalina/localhost is different than an updated context.xml, so when an application tries to look up a jndi resource, it cannot find any. According to this, 2 files must be exactly the same. I come up with 2 explanations, and questions, for this case:
I wonder if there is anyone see those issues before, if there is, I really appreciate any solutions. Or, if you have other explanation and/or question for my case, you're welcome! Thanks :)
L
PS: the tomcat is in my company's server, so I cannot just go and change appname.xml directly :(
Explanation 1 is the answer, there is a issue in redeployment which leaves appname.xml unchanged. The issue relates to my company's way of deploying application: we use a script to remove application and add an updated version in CATALINA_BASE/webapp folder then restart tomcat instead of using tomcat's manager page.
L