Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Tomcat and path with pound sign (#) -> ClassNotFoundException

Markus Schiegl

2007-08-08

Replies:

Hi there,

starting Tomcat from a path containing a pound sign (#) somewhere
results in a ClassNotFoundException.

I've checked this with
- Solaris Sparc/X86 + Mac OS X
- Java 5 + 6
- Tomcat 5.5.23 + 6.0.13

example:
- mkdir /export/home/markus/tomcat#1
- extract tomcat within this directory
- export JAVA_HOME=/usr/java (JDK 6)
- /export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/startup.sh
or
cd /export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin ; ./startup.sh

output from catalina.sh with the java call (added set -x to catalina.sh
- i.e. no problem of the calling script omitting something)

/usr/java/bin/java
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=/export/home/markus/tomcat#1/apache-tomcat-6.0.13/conf/logging.properties
-Djava.endorsed.dirs=/export/home/markus/tomcat#1/apache-tomcat-6.0.13/endorsed
-classpath
:/export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/bootstrap.jar:/export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/commons-logging-api.jar
-Dcatalina.base=/export/home/markus/tomcat#1/apache-tomcat-6.0.13
-Dcatalina.home=/export/home/markus/tomcat#1/apache-tomcat-6.0.13
-Djava.io.tmpdir=/export/home/markus/tomcat#1/apache-tomcat-6.0.13/temp
org.apache.catalina.startup.Bootstrap start

$cat catalina.out
java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass (URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
    at org.apache.catalina.startup.Bootstrap.init (Bootstrap.java:215)
    at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:390)


truss output: path was truncated after the # sign:

...
2717/2:      read(5, "CAFEBABE\0\0\0 1\00701\0".., 142)    = 142
2717/2:
stat64("/export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/org/apache/catalina/security/SecurityClassLoad.class",
0xD230ABF0) Err#2 ENOENT
2717/2:      llseek(9, 1422, SEEK_SET)               = 1422
2717/2:      read(9, " P K0304\n\0\0\0\b\0F91C".., 30)     = 30
2717/2:      llseek(9, 1504, SEEK_SET)               = 1504
2717/2:      read(9, "95 W k o14 U18 ~ f [DAC3".., 1634)   = 1634
2717/2:      brk(0x08172F08)                      = 0
2717/2:      brk(0x08176F08)                      = 0
2717/9:      pollsys(0x00000000, 0, 0xCFCA9CD8, 0x00000000) = 0
2717/2:
stat64("/export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/org/apache/catalina/startup/Catalina.class",
0xD230B3D0) Err#2 ENOENT
2717/2:      stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2
ENOENT
2717/2:      stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2
ENOENT
2717/2:      stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2
ENOENT
2717/2:      stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2
ENOENT
2717/3:      lwp_cond_wait(0x0806F7A0, 0x0806F788, 0xD208DB48, 0)
(sleeping...)
2717/3:      lwp_cond_wait(0x0806F7A0, 0x0806F788, 0xD208DB48, 0)
Err#62 ETIME
2717/9:      pollsys(0x00000000, 0, 0xCFCA9CD8, 0x00000000) = 0
2717/2:      stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2
ENOENT
2717/2:      stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2
ENOENT
2717/2:      stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2
ENOENT
...

Although there is a rather old but maybe similar bug at:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4231042
i supose somewhere the road this has been fixed, as i have no problems
with JAVA 5/6 and other java programs otherwise my tests where flawed.

Installing the jdk in such a directory (e.g. /opt/java#6) works with
tomcat, too.

Can anybody confirm that "#" is still a special character (for tomcat)?
Unfortunately i'm somewhat forced to place tomcat installations/
instances into such (with #) directories.

Any fix possible?

thanks in advance!

kind regards,
 Markus


---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.