Startup

Server Startup

This page describes how the Tomcat server starts up. There are several different ways to start tomcat, including:

  • From the command line.
  • From a Java program as an embedded server.
  • Automatically as a Windows service.

description

A text description of the startup procedure created for Tomcat 5. The updated version of this description for Tomcat 11 will be included in the updated diagrams and diagram descriptions in the following section. This text file will be removed when that update is complete.

diagram

The UML sequence diagram of the startup procedure created for Tomcat 5 is gradually being replaced with updated diagrams based on Tomcat 11. The scope of these diagrams may be adjusted as they are produced.

A series of UML diagrams have been created to document the start-up process for Tomcat.

Diagram 1 shows an overview of how Tomcat start, serves requests and then stops. Once the class loaders have been initialized, Tomcat parses server.xml using the Digester and the Digester creates the objects defined in server.xml, configures them using the property values defined in server.xml and the starts the Server. The main Java thread waits in the await() method for a shutdown signal. Once a shutdown signal is received, the Server object is stopped and then destroyed. The JVM then exits.

Diagram 2 will show how the Server initialises the Connectors and associated objects.

Diagram 3 will show how the Server initialises the Service(s), Engine(s) and Host(s).

Diagram 4 will show how the Host initialises the Context(s).

Diagram 5 will show how the Context initialises the Filters, Servlets etc.

comments

The startup process can be customized in many ways, both by modifying Tomcat code and by implementing your own LifecycleListeners which are then registered in the server.xml configuration file.