Bug 55336 - Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.
Summary: Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-01 05:00 UTC by TRAN Trung-Thanh
Modified: 2013-08-01 10:44 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description TRAN Trung-Thanh 2013-08-01 05:00:34 UTC
Today, I tried to start apache tomcat 7.0.42 in Linux environment. Server path contains two consecutive spaces. When I run ./catalina.sh run, server cannot start and there is the following exception in console

./catalina.sh run
Using CATALINA_BASE:   /home/example/twoconsecutive  spaces
Using CATALINA_HOME:   /home/example/twoconsecutive  spaces
Using CATALINA_TMPDIR: /home/example/twoconsecutive  spaces/temp
Using JRE_HOME:        /home/example/java/jdk1.6
Using CLASSPATH:       /home/example/twoconsecutive spaces/bin/bootstrap.jar:/home/example/twoconsecutive spaces/bin/tomcat-juli.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/catalina/startup/Bootstrap
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.startup.Bootstrap
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.catalina.startup.Bootstrap.  Program will exit.

Tomcat server can start if  server path does not contain consecutive space.
Comment 1 Rainer Jung 2013-08-01 08:25:40 UTC
Adding analysis reported by Ognjen Blagojevic on tomcat users here:

On several places in catalina.sh, there is eval command which seems to be inproperly escaped. E.g, if I want to pass parameter with two consecutive spaces using eval, this is the wrong way to do it:

  eval echo \"foo  bar\" (prints: foo bar)

This is the right way to do it:

  eval echo "\"foo  bar\"" (prints: foo  bar)

I believe that catalina.sh should quote every parameter pass to eval in order to prevent whitespace collapse.
Comment 2 Mark Thomas 2013-08-01 10:44:36 UTC
Thanks for the report and the suggested fix.

The fix has been applied to trunk and 7.0.x and will be included in 7.0.43 onwards.