How is Tomcat activated?


Publication Date:January 8, 2021



INFOMARTION > How is Tomcat activated?

summary

I would like to explain how Tomcat starts. You usually start Tomcat from a batch file or shell file, but we would like to see what the batch file or shell file actually does. The version of Tomcat to be checked is "9.0.27".

The instructions for downloading the version "9.0.27" of Tomcat are also explained below, so please refer to this page if you need it.

Download Tomcat

Table of Contents

  1. How Tomcat starts
  2. summary

1. How Tomcat starts

As it turns out, Tomcat is started by the following Java command. (The assumption is that the Tomcat version is "9.0.27" and the Java version is "OpenJDK11".)

"C:\Program Files (x86)\Java\jdk-11\bin\java.exe" -Djava.util.logging.config.file="C:\apache-tomcat-9.0.27\conf\logging.properties" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dignore.endorsed.dirs="" -classpath "C:\apache-tomcat-9.0.27\bin\bootstrap.jar;C:\apache-tomcat-9.0.27\bin\tomcat-juli.jar" -Dcatalina.base="C:\apache-tomcat-9.0.27" -Dcatalina.home="C:\apache-tomcat-9.0.27" -Djava.io.tmpdir="C:\apache-tomcat-9.0.27\temp" org.apache.catalina.startup.Bootstrap start

In short, Tomcat is finally started by executing the above one-line Java command and calling the main class (public static void main(String[] args)).

※If you do not understand what the "-D~" part does, please refer to the following.

What is the D option (-D) specified at Java startup?

Finally, one line of command is executed, but I would like to see what startup.bat is doing.

1-1. Contents of startup.bat

The startup.bat simply checks the environment settings to start Tomcat, and then catalina.bat is executed with the argument start. The actual main processing is described in catalina.bat.

So, what we are doing with catalina.bat is assembling the final command to be executed, as described earlier. Specifically, the command is assembled by looking for the following

  • Java directory to start
  • Java classpath, main class
  • Java Options (lessening the significance or value of the previous word) the likes of

After searching the above, we finally execute a one-line Java command.

2. summary

Tomcat is started from a batch file such as startup.bat, but ultimately Tomcat is started by a single line Java command. This command calls the main class (public static void main(String[] args)) and starts processing.

Incidentally, the main class for Tomcat is located in "org.apache.catalina.startup.Bootstrap".

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.