You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by TRAN Trung Thanh <th...@exoplatform.com> on 2013/07/31 07:11:13 UTC

Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.

Hi all,
I am newbie here.
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.

Do anyone face to the same issue with me in this case? Have you any 
suggestion to fix this issue?  It is quite important for my deployment.

Thanks in advance and best regards,


-- 
TRAN Trung-Thanh


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.

Posted by TRAN Trung Thanh <th...@exoplatform.com>.
Hi Micheal-O,
I do not understand well your suggestion. Which file should be improved, 
catalina.sh, right?

Anyway, I tried to deploy tomcat default package. AFAIK, quote and slash 
is used to fix problem if there is a space in path. According my test 
result, in Tomcat 7, in case of having no consecutive spaces, there is 
no problem.

BR,
On 07/31/2013 01:22 PM, Michael-O wrote:
> Am 2013-07-31 07:11, schrieb TRAN Trung Thanh:
>> Hi all,
>> I am newbie here.
>> 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.
>>
>> Do anyone face to the same issue with me in this case? Have you any
>> suggestion to fix this issue?  It is quite important for my deployment.
>
> Did you try to quote or use backslash escapes?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


-- 
TRAN Trung-Thanh


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.

Posted by Michael-O <19...@gmx.net>.
Am 2013-07-31 07:11, schrieb TRAN Trung Thanh:
> Hi all,
> I am newbie here.
> 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.
>
> Do anyone face to the same issue with me in this case? Have you any
> suggestion to fix this issue?  It is quite important for my deployment.

Did you try to quote or use backslash escapes?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.

Posted by Ognjen Blagojevic <og...@gmail.com>.
Tran,

On 31.7.2013 7:11, TRAN Trung Thanh wrote:
> 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

I am able to reproduce the same problem. It seems that the problem is in 
catalina.sh.

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.


Please file a bug report in Bugzilla:

   https://issues.apache.org/bugzilla/


-Ognjen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.

Posted by Tomcat Random <to...@gmail.com>.
"Spaces in paths (and filenames) are evil, and should never have been
allowed in the first place.  A special place in hell is reserved for the
genius who first allowed this stupid thing in an OS.

Luled at this.

The underscore is your friend. I find it odd that the OP can't just rename
said directories, but who knows: there's always inheriting a lot of WTF's
from an existing project that just leads to non-stop facepalming.


On Wed, Jul 31, 2013 at 1:27 PM, André Warnier <aw...@ice-sa.com> wrote:

> TRAN Trung Thanh wrote:
>
>> Hi all,
>> I am newbie here.
>> 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.
>>
>> Do anyone face to the same issue with me in this case? Have you any
>> suggestion to fix this issue?
>>
>
> Yes : don't do that (using spaces in paths).
>
>
>   It is quite important for my deployment.
>
>>
>>
> That's a pity.
> Spaces in paths (and filenames) are evil, and should never have been
> allowed in the first place.  A special place in hell is reserved for the
> genius who first allowed this stupid thing in an OS.  I wish I had 0.1 cent
> for every programming hour lost because of this.
>
> Technically, you can certainly find the correct way to quote them in any
> particular place and environment.  But usually, this is merely moving the
> problem to some other place further down the line, where it is even less
> visible and harder to find the bugs.
> I suppose the same could be said about any non-visible character, but
> spaces (along with TAB) are specially evil because in most environments,
> they are considered either as valid separators between words/tokens or as
> "non-significant".
>
> My serious recommendation would be to think really hard about a way to nip
> this in the bud, and avoid allowing them and using them in the first place.
> Think that if you allow them somewhere, and even if you quote them
> correctly there, you will have to continue quoting them (appropriately)
> everywhere else that you are using the corresponding strings.  It is almost
> guaranteed that this will bite you somewhere.
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

OT: Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
> -----Original Message-----
> From: Michael-O [mailto:1983-01-06@gmx.net]
> Sent: Thursday, August 01, 2013 1:10 PM
> To: Tomcat Users List
> Subject: Re: Cannot start apache tomcat 7.0 if server path contains two
> consecutive spaces.
> 
> Am 2013-08-01 15:41, schrieb Jeffrey Janner:
> >> -----Original Message-----
> >> From: André Warnier [mailto:aw@ice-sa.com]
> >> Sent: Wednesday, July 31, 2013 12:27 PM
> >> To: Tomcat Users List
> >> Subject: Re: Cannot start apache tomcat 7.0 if server path contains
> >> two consecutive spaces.
> >>
> >> TRAN Trung Thanh wrote:
> >>> Hi all,
> >>> I am newbie here.
> >>> 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.
> >>>
> >>> Do anyone face to the same issue with me in this case? Have you any
> >>> suggestion to fix this issue?
> >>
> >> Yes : don't do that (using spaces in paths).
> >>
> >>     It is quite important for my deployment.
> >>>
> >>
> >> That's a pity.
> >> Spaces in paths (and filenames) are evil, and should never have been
> >> allowed in the first place.  A special place in hell is reserved for
> >> the genius who first allowed this stupid thing in an OS.  I wish I
> >> had
> >> 0.1 cent for every programming hour lost because of this.
> >>
> >> Technically, you can certainly find the correct way to quote them in
> >> any particular place and environment.  But usually, this is merely
> >> moving the problem to some other place further down the line, where
> >> it is even less visible and harder to find the bugs.
> >> I suppose the same could be said about any non-visible character,
> but
> >> spaces (along with
> >> TAB) are specially evil because in most environments, they are
> >> considered either as valid separators between words/tokens or as
> >> "non- significant".
> >>
> >> My serious recommendation would be to think really hard about a way
> >> to nip this in the bud, and avoid allowing them and using them in
> the
> >> first place.
> >> Think that if you allow them somewhere, and even if you quote them
> >> correctly there, you will have to continue quoting them
> >> (appropriately) everywhere else that you are using the corresponding
> >> strings.  It is almost guaranteed that this will bite you somewhere.
> >>
> >>
> >
> > Agree with everything Andre says here. Even under Windows, where the
> OS seems to handle it fine, as long as you're in the GUI, it is a
> problem.  You have to remember to quote the path everytime you want to
> use it at the command line level, or in PowerShell, etc.
> > It is really easier to remember that if you want the look of a space,
> but need a non-printable character, to just use the underbar.  How much
> easier things could be if instead of "My Documents" you could write
> My_Documents.  Still looks like two words but it is only one.
> > As long as you have control over the naming, you should follow this
> advise.
> > Jeff
> 
> I guess for that reason Microsoft has replaced the C:\Documents and
> Settings folder.
> 
Possibly, because it's now called "C:\Users". Now if they'd only abandon that silly backslash file separator character...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.

Posted by Michael-O <19...@gmx.net>.
Am 2013-08-01 15:41, schrieb Jeffrey Janner:
>> -----Original Message-----
>> From: André Warnier [mailto:aw@ice-sa.com]
>> Sent: Wednesday, July 31, 2013 12:27 PM
>> To: Tomcat Users List
>> Subject: Re: Cannot start apache tomcat 7.0 if server path contains two
>> consecutive spaces.
>>
>> TRAN Trung Thanh wrote:
>>> Hi all,
>>> I am newbie here.
>>> 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.
>>>
>>> Do anyone face to the same issue with me in this case? Have you any
>>> suggestion to fix this issue?
>>
>> Yes : don't do that (using spaces in paths).
>>
>>     It is quite important for my deployment.
>>>
>>
>> That's a pity.
>> Spaces in paths (and filenames) are evil, and should never have been
>> allowed in the first place.  A special place in hell is reserved for
>> the genius who first allowed this stupid thing in an OS.  I wish I had
>> 0.1 cent for every programming hour lost because of this.
>>
>> Technically, you can certainly find the correct way to quote them in
>> any particular place and environment.  But usually, this is merely
>> moving the problem to some other place further down the line, where it
>> is even less visible and harder to find the bugs.
>> I suppose the same could be said about any non-visible character, but
>> spaces (along with
>> TAB) are specially evil because in most environments, they are
>> considered either as valid separators between words/tokens or as "non-
>> significant".
>>
>> My serious recommendation would be to think really hard about a way to
>> nip this in the bud, and avoid allowing them and using them in the
>> first place.
>> Think that if you allow them somewhere, and even if you quote them
>> correctly there, you will have to continue quoting them (appropriately)
>> everywhere else that you are using the corresponding strings.  It is
>> almost guaranteed that this will bite you somewhere.
>>
>>
>
> Agree with everything Andre says here. Even under Windows, where the OS seems to handle it fine, as long as you're in the GUI, it is a problem.  You have to remember to quote the path everytime you want to use it at the command line level, or in PowerShell, etc.
> It is really easier to remember that if you want the look of a space, but need a non-printable character, to just use the underbar.  How much easier things could be if instead of "My Documents" you could write My_Documents.  Still looks like two words but it is only one.
> As long as you have control over the naming, you should follow this advise.
> Jeff

I guess for that reason Microsoft has replaced the C:\Documents and 
Settings folder.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Wednesday, July 31, 2013 12:27 PM
> To: Tomcat Users List
> Subject: Re: Cannot start apache tomcat 7.0 if server path contains two
> consecutive spaces.
> 
> TRAN Trung Thanh wrote:
> > Hi all,
> > I am newbie here.
> > 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.
> >
> > Do anyone face to the same issue with me in this case? Have you any
> > suggestion to fix this issue?
> 
> Yes : don't do that (using spaces in paths).
> 
>    It is quite important for my deployment.
> >
> 
> That's a pity.
> Spaces in paths (and filenames) are evil, and should never have been
> allowed in the first place.  A special place in hell is reserved for
> the genius who first allowed this stupid thing in an OS.  I wish I had
> 0.1 cent for every programming hour lost because of this.
> 
> Technically, you can certainly find the correct way to quote them in
> any particular place and environment.  But usually, this is merely
> moving the problem to some other place further down the line, where it
> is even less visible and harder to find the bugs.
> I suppose the same could be said about any non-visible character, but
> spaces (along with
> TAB) are specially evil because in most environments, they are
> considered either as valid separators between words/tokens or as "non-
> significant".
> 
> My serious recommendation would be to think really hard about a way to
> nip this in the bud, and avoid allowing them and using them in the
> first place.
> Think that if you allow them somewhere, and even if you quote them
> correctly there, you will have to continue quoting them (appropriately)
> everywhere else that you are using the corresponding strings.  It is
> almost guaranteed that this will bite you somewhere.
> 
> 

Agree with everything Andre says here. Even under Windows, where the OS seems to handle it fine, as long as you're in the GUI, it is a problem.  You have to remember to quote the path everytime you want to use it at the command line level, or in PowerShell, etc. 
It is really easier to remember that if you want the look of a space, but need a non-printable character, to just use the underbar.  How much easier things could be if instead of "My Documents" you could write My_Documents.  Still looks like two words but it is only one.
As long as you have control over the naming, you should follow this advise. 
Jeff


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Cannot start apache tomcat 7.0 if server path contains two consecutive spaces.

Posted by André Warnier <aw...@ice-sa.com>.
TRAN Trung Thanh wrote:
> Hi all,
> I am newbie here.
> 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.
> 
> Do anyone face to the same issue with me in this case? Have you any 
> suggestion to fix this issue?

Yes : don't do that (using spaces in paths).

   It is quite important for my deployment.
> 

That's a pity.
Spaces in paths (and filenames) are evil, and should never have been allowed in the first 
place.  A special place in hell is reserved for the genius who first allowed this stupid 
thing in an OS.  I wish I had 0.1 cent for every programming hour lost because of this.

Technically, you can certainly find the correct way to quote them in any particular place 
and environment.  But usually, this is merely moving the problem to some other place 
further down the line, where it is even less visible and harder to find the bugs.
I suppose the same could be said about any non-visible character, but spaces (along with 
TAB) are specially evil because in most environments, they are considered either as valid 
separators between words/tokens or as "non-significant".

My serious recommendation would be to think really hard about a way to nip this in the 
bud, and avoid allowing them and using them in the first place.
Think that if you allow them somewhere, and even if you quote them correctly there, you 
will have to continue quoting them (appropriately) everywhere else that you are using the 
corresponding strings.  It is almost guaranteed that this will bite you somewhere.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org