1

我正在从 .zip 安装 tomcat 并使用 service.bat 文件。我注意到如果 catalina_base 或 catalina_home 路径中有空格,它不会正确设置。

我使用以下内容调用 service.bat:

set CATALINA_HOME=C:\Program Files\Apache Software Foundation\Tomcat 10.0
set CATALINA_BASE=C:\Program Files\Apache Software Foundation\Tomcat 10.0
set JRE_HOME=C:\Program Files (x86)\Java\jre1.8.0_151
set SERVICE_STARTUP_MODE=auto

call "%CATALINA_HOME%\bin\service.bat" install

这是从 service.bat 输出的命令:

 "C:\Program Files\Apache Software Foundation\Tomcat 10.0\bin\Tomcat10.exe" //IS//Tomcat10     
    --Description "Apache Tomcat 10.0.5 Server - https://tomcat.apache.org/"     
    --DisplayName "Apache Tomcat 10.0 Tomcat10"     
    --Install "C:\Program Files\Apache Software Foundation\Tomcat 10.0\bin\Tomcat10.exe"     
    --LogPath "C:\Program Files\Apache Software Foundation\Tomcat 10.0\logs"     
    --StdOutput auto     
    --StdError auto     
    --Classpath "C:\Program Files\Apache Software Foundation\Tomcat 10.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 10.0\bin\tomcat-juli.jar"     
    --Jvm "C:\Program Files (x86)\Java\jre1.8.0_151\bin\client\jvm.dll"     
    --StartMode jvm     
    --StopMode jvm     
    --StartPath "C:\Program Files\Apache Software Foundation\Tomcat 10.0"     
    --StopPath "C:\Program Files\Apache Software Foundation\Tomcat 10.0"     
    --StartClass org.apache.catalina.startup.Bootstrap     
    --StopClass org.apache.catalina.startup.Bootstrap     
    --StartParams start     
    --StopParams stop     
    --JvmOptions "-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 10.0;-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 10.0;-Dignore.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 10.0\endorsed;-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 10.0\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 10.0\conf\logging.properties;"     
     --JvmOptions9 "--add-opens=java.base/java.lang=ALL-UNNAMED#--add-opens=java.base/java.io=ALL-UNNAMED#--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED"     
    --Startup "auto"     
    --JvmMs "128"     
    --JvmMx "256" 

这会导致许多问题,因为 jvm 选项不正确,因为没有正确的引号来处理路径中的空格。我该如何处理?

仅供参考,这会导致 Tomcat 的配置元素无法找到 ${catalina.home} 用于日志记录和路径。

4

0 回答 0