Tomcat 7 start-up errors from Eclipse - Unable to process JNDI URL
If I create a dynamic web application in Eclipse and the context root doesn't match the WAR name, I get an error when starting up the associated Tomcat 7 server...
SEVERE: Unable to process JNDI URL [jndi:/localhost/tests/example1/WEB-INF/classes] for annotations
java.io.FileNotFoundException: jndi:/localhost/tests/example1/WEB-INF/classes
at org.apache.naming.resources.DirContextURLConnection.list(DirContextURLConnection.java:452)
at org.apache.catalina.startu开发者_运维百科p.ContextConfig.processAnnotationsJndi(ContextConfig.java:1843)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1770)
etc,
The relevant part (I think) of the server.xml file is,
<Context docBase="MyExample" path="/tests/example1" reloadable="true" source="org.eclipse.jst.jee.server:MyExample"/>
The application is accessible via the /tests/example1
as I'd expect, but servlet annotations don't work and the error itself causes the server startup to take longer than it should. If the context root matches the WAR name, it works fine, but that will be a problem for me going forward.
Any ideas how I can work around this?
UPDATE: I've found this to only happen if the modified context root contains a /
. If I change the context root to "tests-example1" it works.
I had the same problem with Tomcat 7.0.16 but it works with Tomcat 7.0.22.
We had such problem with Tomcat 6.0.36. We found the solution while editing the Spring configuration. We changed
<xconf:properties href="${...}/..." prefix="..." />
to
<xconf:properties file="${...}/...." prefix="..." />
and set all relative paths to fixed ones where needed.
Maybe, some paths were changed in your application, but you have forgot to update app configs. So, I think, you should check your application configs first. Search for 'example1' in Spring configs, etc.
精彩评论