<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!DOCTYPE document [
  <!ENTITY project SYSTEM "project.xml">
]>
<document url="startup.html">

  &project;

  <properties>
    <author email="yoavs@apache.org">Yoav Shapira</author>
    <title>Startup</title>
  </properties>

<body>


<section name="Server Startup">

<p>
This page describes how the Tomcat server starts up.  There are several
different ways to start tomcat, including:
</p>
<ul>
  <li>From the command line.</li>
  <li>From a Java program as an embedded server.</li>
  <li>Automatically as a Windows service.</li>
</ul>

<subsection name="description">
<p>
A <a href="startup/serverStartup.txt">text description</a> 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.
</p>
</subsection>

<subsection name="diagram">
<p>
The <a href="startup/serverStartup.pdf">UML sequence diagram</a> 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.
</p>
<p>
A series of UML diagrams have been created to document the start-up process for
Tomcat.
</p>
<p>
<a href="startup/1_overview.png">Diagram 1</a> 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.
</p>
<p>
Diagram 2 will show how the Server initialises the Connectors and associated
objects.
</p>
<p>
Diagram 3 will show how the Server initialises the Service(s), Engine(s) and
Host(s).
</p>
<p>
Diagram 4 will show how the Host initialises the Context(s).
</p>
<p>
Diagram 5 will show how the Context initialises the Filters, Servlets etc.
</p>
</subsection>

<subsection name="comments">
<p>
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.
</p>

</subsection>

</section>


</body>
</document>
