Bug 27988 - Unhelpful FileNotFoundException raised
Unhelpful FileNotFoundException raised
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
5.5.33
All All
: P3 enhancement (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2004-03-26 17:01 UTC by richard.beton
Modified: 2011-04-10 06:46 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description richard.beton 2004-03-26 17:01:25 UTC
org.apache.naming.resources.DirContextURLConnection raises FileNotFoundException
on lines 311, 344, 382 and 396.  It would be more helpful if these provided a
message string.

For example, change line 344 to
        throw new FileNotFoundException(getURL().getFile());

This would make it easier to diagnose mistakes in server configurations.
Comment 1 richard.beton 2004-03-26 17:04:32 UTC
Here's my stack trace that left me baffled at first:

javax.servlet.ServletException: Exception processing JAR at resource path
/WEB-INF/lib/log4j-1.2.8.jar
	at org.apache.catalina.startup.ContextConfig.tldScanJar(ContextConfig.java:930)
	at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:868)
	at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:647)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:243)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:3582)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
	at org.apache.catalina.core.StandardService.start(StandardService.java:497)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
	at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
	at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
----- Root Cause -----
java.io.FileNotFoundException
	at
org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnection.java:344)
	at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:161)
	at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:42)
	at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:78)
	at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:85)
	at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:69)
	at org.apache.catalina.startup.ContextConfig.tldScanJar(ContextConfig.java:906)
	at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:868)
	at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:647)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:243)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:3582)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
	at org.apache.catalina.core.StandardService.start(StandardService.java:497)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
	at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
	at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Comment 2 Mark Thomas 2011-03-02 08:30:41 UTC
The TLD scanning was completely re-written for Tomcat 7 so the error messages there should be a lot better.

I have added the URL (where it isn't null) to the Exception message so it is available for any other code paths that may trigger it. This change has been made to 7.0.x and will be included in 7.0.9 onwards.

I have also proposed the same change for 6.0.x and 5.5.x.

Since 5.5.x is the oldest currently supported version, I am moving this bug to that version.
Comment 3 Mark Thomas 2011-04-01 11:12:27 UTC
Fixed in 6.0.x and will be included in 6.0.33 onwards.
Comment 4 Mark Thomas 2011-04-10 06:46:35 UTC
Fixed in 5.5.x, will be included in 5.5.34 onwards.