windowstomcatenvironment-variablesprocrun

TOMCAT: quote < ' > in CATALINA_HOME environment variable causing load error?


I'm trying to install tomcat as a service using service.bat in the following path : C:\Program Files\text with' quote\Tomcat

but I keep getting the following error : java.io.FileNotFoundException: C:\Program Files\text with quote\Tomcat\conf\logging.properties; (The system cannot find the path specified)

as you can see from the error message the ' is being ignored and thus keeping some files from being found/loaded properly.

If I switch to a path without a quote, everything works well. Is there a way around this as I need to include a ' in the path?


Solution

  • Your problem comes from the way Procrun parses its command line parameters. In those parameters which accept lists of values (++DependsOn, ++Environment, ++JvmOptions, ++JvmOptions9, ++StartParams and ++StopParams) single quotes ' are stripped after the parameter value has been split into single values. There is no way to quote them (cf. source code).

    Therefore the ++JvmOptions parameter used in service.bat is interpreted as follows (one value per line):

    -Dcatalina.home=C:\Scarlett oHara;-Dcatalina.base=C:\Scarlett oHara
    -Dignore.endorsed.dirs=C:\Scarlett oHara\endorsed;-Djava.io.tmpdir=C:\Scarlett oHara\temp
    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    -Djava.util.logging.config.file=C:\Scarlett oHara\conf\logging.properties;
    

    You might notice that some entries are joined by ;, due to the ' unintentional quoting.

    The only way to fix this is to start Prunmgr (the executable renamed as tomcat*w.exe) and fix them in the "Java" tab:

    -Dcatalina.home=C:\Scarlett o'Hara
    -Dcatalina.base=C:\Scarlett o'Hara
    -Dignore.endorsed.dirs=C:\Scarlett o'Hara\endorsed
    -Djava.io.tmpdir=C:\Scarlett o'Hara\temp
    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    -Djava.util.logging.config.file=C:\Scarlett o'Hara\conf\logging.properties;
    

    or work directly on the HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0 registry keys.

    See also: