Causes of Tomcat not starting


Publication Date:January 8, 2021



INFOMARTION > Causes of Tomcat not starting

summary

This is about the cause of Tomcat not starting and how to fix it. The following are the causes and solutions for cases where Tomcat does not start for some reason and an error occurs even after executing startup.bat or startup.sh. I would like to explain based on Tomcat version "9.0.27".

Table of Contents

  1. Causes of Tomcat not starting
  2. summary

1. Causes of Tomcat not starting

There are various causes of Tomcat not starting, but this is a list of the main events that can cause Tomcat not to start.

1-1. JAVA_HOME is not set.

【cause】

If neither JAVA_HOME nor JRE_HOME is set, the following error will be output.

startup.bat


C:\Users\user>C:\apache-tomcat-9.0.27\bin\startup.bat
The JRE_HOME environment variable is not defined correctly
This environment variable is needed to run this program

【How to deal with it】

Set JAVA_HOME or JRE_HOME from "System Properties, Advanced, Environment Variables". If the settings are correct, typing "echo %JAVA_HOME%" or "echo %JRE_HOME%" at the command prompt will produce the following output. As a precaution, restart the command prompt if you change environment variables. Environment variables are read when the command prompt is started.

C:\Users\user>echo %JAVA_HOME%
C:\Program Files (x86)\Java\jdk-11

1-2. JAVA version is not compatible with Tomcat

【cause】

Tomcat has a supported Java version. The following Tomcat site describes it.

https://tomcat.apache.org/whichversion.html

For example, if Tomcat version "9.0.27" is "9.0.x" in "Apache Tomcat Version" on the above site, it will be "8 and later".

In other words, setting Java 8 or later will work.

【How to deal with it】

Rewrite the environment variable to the corresponding Java based on the following Tomcat site.

https://tomcat.apache.org/whichversion.html

1-3. JRE_HOME is enabled

【cause】

If "JRE_HOME" and "JAVA_HOME" are set for Tomcat, "JRE_HOME" is more effective. Even if you look at "JAVA_HOME" and see that Java is compatible with Tomcat, "JRE_HOME" will work, so "JRE_HOME" must be the Java that is compatible with Tomcat.

【How to deal with it】

From "System Properties, Advanced Settings, Environment Variables", rewrite Java in JRE_HOME to Java corresponding to Tomcat.

1-4. Conflicting port numbers.

【cause】

Tomcat starts on port 8080 by default. If there are other applications running on port 8080, the following error will be output.

Critical [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[HTTP/1.1-8080]]

【How to deal with it】

Change the port of Tomcat, or stop applications with conflicting port numbers that are running.

The following command will tell you if there is a port number conflict. The "8080" part should be adjusted to your own environment. If you have not changed any settings, the value will be 8080. If nothing is activated, no response is returned.

※The following commands are for Windows.

C:\Users\user>netstat -nao | find "8080"
  TCP         0.0.0.0:8080           0.0.0.0:0              LISTENING       5748
  TCP         [::]:8080              [::]:0                 LISTENING       5748
  TCP         [::1]:8080             [::1]:58259            TIME_WAIT       0
  TCP         [::1]:8080             [::1]:58260            TIME_WAIT       0
  TCP         [::1]:8080             [::1]:58261            TIME_WAIT       0

2. summary

If Tomcat does not start, check the following four points.

  • JAVA_HOME is not set.
  • JAVA version is not compatible with Tomcat
  • JRE_HOME is enabled
  • Conflicting port numbers.

If that does not work, please refer to the following article for a description of how Tomcat is started in the first place.

How is Tomcat activated?

Thank you for taking the time to read this to the end.




■INFORMATION

Please click here to go to the top page of INFORMATION.


■PROFILE

Please click here to view the profile.


■For inquiries, please contact

For inquiries about the article, please contact us here.