Bug 43150

Summary: Tomcat and path with pound sign (#) -> ClassNotFoundException
Product: Tomcat 6 Reporter: Markus Schiegl <apache>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: normal CC: hrendalf
Priority: P2    
Version: 6.0.14   
Target Milestone: default   
Hardware: All   
OS: All   
URL: http://marc.info/?l=tomcat-user&m=118660647227413&w=2

Description Markus Schiegl 2007-08-16 14:35:07 UTC
Tomcat will not start if it's located and launched from a path with a # (pound)
character somewhere. You'll find all informations in the given mail-thread on
tomcat-user, including some developer specific informations.

One part of the problem is the usage of File.toURL in URLClassloader...

I'd really appreciate it if this problem could be fixed/worked around (see
mail-thread for hints).

btw. the same applies to version 5.5 and probably earlier versions too.

Comment 1 Len Popp 2007-08-17 10:16:16 UTC
I've looked into this problem a bit. Briefly, the exception on startup can be
fixed but that reveals problems in other Tomcat components.

1. CNFE on startup (problem reported by Markus):
Caused by a problem with File.toURL called from o.a.c.startup.ClassLoaderFactory.
Can be fixed by Sun's suggested workaround of using File.toURI and URI.toURL -
see http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#toURL()

2. After fixing that, Tomcat starts but JSPs won't run because Jasper is putting
its output files in the wrong directory.
This is caused by some strange-looking code in
o.a.jasper.JspCompilationContext.createOutputDir that mixes file and URL syntax
together to create the wrong directory.

3, etc. There are several other places in Tomcat where File.toURL is used and I
think it could have problems with "#" in pathnames, but I don't know what the
effects are. I've noted *potential* problems in:
o.a.c.ant, o.a.c.core, o.a.c.ha.deploy, o.a.c.loader, o.a.c.startup, o.a.jasper.

I could help fix some of the problems, but there are lots that I haven't figured
out. Is it worth the trouble to find and fix all the related problems, or is it
better to just tell people not to use unusual directory names?
Comment 2 Mark Thomas 2008-05-01 14:24:05 UTC
I have fixed the bits that are clearly broken and proposed the patch for 6.0.x

As for the rest, if it ain't broke...
Comment 3 Mark Thomas 2008-05-15 12:26:56 UTC
This has been fixed in 6.0.x and will be included in 6.0.17 onwards.
Comment 4 Mark Thomas 2008-12-23 07:22:37 UTC
*** Bug 46400 has been marked as a duplicate of this bug. ***