Bug 43150 - Tomcat and path with pound sign (#) -> ClassNotFoundException
Summary: Tomcat and path with pound sign (#) -> ClassNotFoundException
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.14
Hardware: All All
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL: http://marc.info/?l=tomcat-user&m=118...
Keywords:
: 46400 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-08-16 14:35 UTC by Markus Schiegl
Modified: 2014-02-17 13:57 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.

thanks!
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. ***