-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Long,
On 11/19/12 2:38 PM, Long Thai wrote: > 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 tomcat document, 2 files > must be exactly the same. I come up with 2 explanations, and > questions, for this case: - There is an issue that makes > appname.xml unchanged during redeployment - Although I change > context.xml, tomcat still stores an old version somewhere and use > it instead of a new one This is actually expected behavior: upon initial deployment, Tomcat will take the META-INF/context.xml file from your webapp and install it in conf/[Service]/[host]/[app].xml. After that, Tomcat will ignore any context.xml in your webapp unless you UNDEPLOY and REDEPLOY your webapp. This is a feature, not a bug: system administrators often need to customize context.xml for their environments and uploading a new WAR file should not clobber that configuration. If you need to update context.xml, you'll need to undeploy and redeploy (or edit the conf/.../[app].xml in place and bounce Tomcat). - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlCqkkYACgkQ9CaO5/Lv0PBZXwCfU7ImFOZy+uHPmijLdDoWBLgN RMYAniQU0B+3gvG08Ovwy7cKUyVaO16y =9+dE -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org