I've managed to reproduce this on Fedora core 6 and Ubuntu Feisty using the binary distribution tarballs of tomcat 6.0.14 and 5.5.25. export JAVA_HOME=<path to java> tar xzf <path to tarball>/apache-tomcat-*.tar.gz mv apache-tomcat* "my tomcat directory" bash "my tomcat directory/bin/catalina.sh" run result: Using CATALINA_BASE: /home/basil/test/my tomcat directory Using CATALINA_HOME: /home/basil/test/my tomcat directory Using CATALINA_TMPDIR: /home/basil/test/my tomcat directory/temp Using JRE_HOME: /usr/lib/jvm/java-6-sun Exception in thread "main" java.lang.NoClassDefFoundError: tomcat if "my tomcat directory" is replaced with, for example, "mytomcatdirectory", tomcat starts with no error. This error will also occur if a parent directory contains a space and CATALINA_HOME itself doesn't.
Same here on OSX, with 5.5.25 and 5.5.20. This was definitely working with 5.0.28. This can not have been unnoticed for so long, right? What's going on? I'm sure it's been reported many times, but bugzilla being so user-friendly, I could hardly find anything... Anyone knows if this was introduced in 5.5.2x or if it's there since 5.5.0 ?
Note that the exception is slightly different is your path only has one space (I get exactly the same behaviour, i.e NCDFE on the second "word" if several spaces) $ ./startup.sh && tail -f ../logs/catalina.outUsing CATALINA_BASE: /Applications/dev/test test2/apache-tomcat-5.5.25 Using CATALINA_HOME: /Applications/dev/test test2/apache-tomcat-5.5.25 Using CATALINA_TMPDIR: /Applications/dev/test test2/apache-tomcat-5.5.25/temp Using JRE_HOME: /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home Exception in thread "main" java.lang.NoClassDefFoundError: test2/apache-tomcat- 5/5/25/conf/logging/properties ^C
I encountered a similar problem this morning, with CATALINA_BASE containing a space. Here's what I have found: 1. The problem seems to be in the setting of JAVA_OPTS in the following: # Set juli LogManager if it is present if [ -r "$CATALINA_HOME"/bin/tomcat-juli.jar ]; then JAVA_OPTS="$JAVA_OPTS "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" "- Djava.util.logging.config.file="$CATALINA_BASE/conf/logging.properties" fi If CATALINA_BASE has spaces, the shell splits JAVA_OPTS on the spaces when running the Java command line, causing the NCDFE. 2. I confirmed this by removing tomcat-juli.jar from bin, and tomcat started fine. This changed logging, so it wasn't a proper fix. 3. I was able to get things running, including logging, by making the following changes to catalina.sh # Set juli LogManager if it is present if [ -r "$CATALINA_HOME"/bin/tomcat-juli.jar ]; then JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties" fi and then adding "$LOGGING_CONFIG" (note the quotes) to all places where JAVA_OPTS is passed to the java command line. For example: exec "$_RUNJDB" $JAVA_OPTS "$LOGGING_CONFIG" $CATALINA_OPTS \ I'm not sure if this is the best way to fix this, but it works by keeping the spaces inside CATALINA_BASE within quotes when passing the arguments to the java command line. 4. The problem exists in the latest 5.5 (5.5.25) and 6.0 (6.0.14), but not in 5.0.x.
Thanks for the patch suggestion. This has been committed to trunk and proposed for 6.0.x and 5.5.x.
This has been applied to 6.0.x and will be included in 6.0.17 onwards.
Hi, I can't start tomcat with this patch at Mac OS X ( 10.4.11). catalina.out Exception in thread "main" java.lang.NoClassDefFoundError: #!/bin/bash export CATALINA_HOME=/Users/peter/xxxx/apache-tomcat-6.0.18 export CATALINA_BASE=/Users/peter/xxxx/node01 exec $CATALINA_HOME/bin/catalina.sh start "$@" The tomcat start fails as I set CATALINA_BASE to other directory then CATALINA_HOME. After I remove quotes from $LOGGING_CONFIG at $CATALINA_HOME/bin/catalina.sh it works. Strange! I have no spaces at my paths and with 6.0.16 tomcat start perfect. I think the LOGGING_CONFIG variable must also set at stop command at catalina.sh. Peter
(In reply to comment #6) > I can't start tomcat with this patch at Mac OS X ( 10.4.11). I've just tried this with Rémy's 6.0.18 buildon Ubuntu Hardy and it works fine - regardless whether or not CATALINA_BASE contains spaces. So, this seems to be a MacOS-specific issue. WAG: What's /bin/sh on MacOS? Does altering the shebang in catalina.sh to #!/bin/bash help?
Hi Peter, see http://marc.info/?l=tomcat-dev&m=121622230731754&w=2
This has been fixed in 5.5.x and will be included in 5.5.27 onwards