Apache Tomcat 7.0.40 disappears after 1 second

后端 未结 5 2236
我寻月下人不归
我寻月下人不归 2021-02-18 22:46

I downloaded apache-tomcat-7.0.40 for Windows 8 and I followed the instructions by using the C:\\apache-tomcat-7.0.40> startup.bat at my command prompt. The tomc

5条回答
  •  执笔经年
    2021-02-18 23:15

    Your problem is, most likely, wrong path of the CATALINA_HOME environment variable.

    Answers above would help, but I will add one point, which would be more extensive as it may help for different kind of exceptions connected to server startup, and namely - to CATALINA_HOME.

    In the late versions of Tomcat, You actually do not need to set environment variable CATALINA_HOME. If you'll have a look inside start startup.bat, the script sets it itself upon each execution.

    [23-30] lines of the script in Tomcat 9:

    rem Guess CATALINA_HOME if not defined
    set "CURRENT_DIR=%cd%"
    if not "%CATALINA_HOME%" == "" goto gotHome
    set "CATALINA_HOME=%CURRENT_DIR%"
    if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
    cd ..
    set "CATALINA_HOME=%cd%"
    cd "%CURRENT_DIR%"
    

    So, just to be safe that your environment variable doesn't mess up with something defined by Tomcat script startup.bat (or anything else), you can either:

    1. Remove your CATALINA_HOME environment variable entirely, as long as you start your server with startup.bat;
    2. Correct your environment variable CATALINA_HOME path if you insist to be starting it otherwise, and make sure, nothing overrides it during run-time.

提交回复
热议问题