Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 771 | blopes | 1 | <!DOCTYPE html SYSTEM "about:legacy-compat"> |
| 2 | <html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><title>Apache Tomcat 9 Architecture (9.0.112) - Startup</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="https://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="https://www.apache.org/" target="_blank"><img src="../images/asf-logo.svg" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>Apache Tomcat 9 Architecture</h1><div class="versionInfo"> |
||
| 3 | Version 9.0.112, |
||
| 4 | <time datetime="2025-11-06">Nov 6 2025</time></div><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2>Links</h2><ul><li><a href="../index.html">Docs Home</a></li><li><a href="index.html">Architecture Home</a></li><li><a href="https://cwiki.apache.org/confluence/display/TOMCAT/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul></div><div><h2>Contents</h2><ul><li><a href="index.html">Contents</a></li><li><a href="overview.html">Overview</a></li><li><a href="startup.html">Server Startup</a></li><li><a href="requestProcess.html">Request Process</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>Startup</h2><h3 id="Server_Startup">Server Startup</h3><div class="text"> |
||
| 5 | |||
| 6 | <p> |
||
| 7 | This page describes how the Tomcat server starts up. There are several |
||
| 8 | different ways to start tomcat, including: |
||
| 9 | </p> |
||
| 10 | <ul> |
||
| 11 | <li>From the command line.</li> |
||
| 12 | <li>From a Java program as an embedded server.</li> |
||
| 13 | <li>Automatically as a Windows service.</li> |
||
| 14 | </ul> |
||
| 15 | |||
| 16 | <p> |
||
| 17 | A series of UML diagrams have been created to document the start-up process for |
||
| 18 | Tomcat. |
||
| 19 | </p> |
||
| 20 | <p> |
||
| 21 | <a href="startup/1_overview.png">Diagram 1</a> shows an overview of how Tomcat |
||
| 22 | start, serves requests and then stops. Once the class loaders have been |
||
| 23 | initialized, Tomcat parses server.xml using the Digester and the Digester |
||
| 24 | creates the objects defined in server.xml, configures them using the property |
||
| 25 | values defined in server.xml and the starts the Server. The main Java thread |
||
| 26 | waits in the await() method for a shutdown signal. Once a shutdown signal is |
||
| 27 | received, the Server object is stopped and then destroyed. The JVM then exits. |
||
| 28 | </p> |
||
| 29 | <p> |
||
| 30 | <a href="startup/2_catalina_init.png">Diagram 2</a> shows how Tomcat initializes |
||
| 31 | the objects created by the Digester in the previous step and when additional key |
||
| 32 | objects are created. A Server may have several Services although it typically |
||
| 33 | only has one. Each Service may have multiple Connectors. A Connector instance is |
||
| 34 | associated with a single Protocol instance and a single CoyoteAdapter instance. |
||
| 35 | </p> |
||
| 36 | <p> |
||
| 37 | <a href="startup/3_catalina_start_1.png">Diagram 3</a> shows how Tomcat starts |
||
| 38 | the objects created by the Digester that were initialized in the previous step. |
||
| 39 | This diagram also shows when lifecycle events are fired. There is more detail to |
||
| 40 | the starting of the Engine (and other Containers) which is shown in the |
||
| 41 | following diagram. |
||
| 42 | </p> |
||
| 43 | <p> |
||
| 44 | <a href="startup/4_catalina_start_2.png">Diagram 4</a> shows how Containers |
||
| 45 | (Engines, Hosts, Contexts and Wrappers) start along with any supporting |
||
| 46 | Clusters, Realms and Valves. |
||
| 47 | </p> |
||
| 48 | <p> |
||
| 49 | <a href="startup/5_catalina_start_3.png">Diagram 5</a> shows the start process |
||
| 50 | for Context elements as it is rather more involved that the other Containers. |
||
| 51 | </p> |
||
| 52 | <p> |
||
| 53 | <a href="startup/6_catalina_host_config.png">Diagram 6</a> shows how the |
||
| 54 | HostConfig component responds to lifecycle events triggered by the Host to |
||
| 55 | deploy web applications to the Host.</p> |
||
| 56 | <p> |
||
| 57 | <a href="startup/7_catalina_context_config.png">Diagram 7</a> shows how the |
||
| 58 | ContextConfig component responds to lifecycle events triggered by the Context to |
||
| 59 | parse the global and application provided configuration files to create a merged |
||
| 60 | web.xml file that is then used, along with other settings, to configure the web |
||
| 61 | application. |
||
| 62 | </p> |
||
| 63 | |||
| 64 | <p> |
||
| 65 | The startup process can be customized in many ways by implementing your own |
||
| 66 | LifecycleListeners which are then registered in the server.xml configuration |
||
| 67 | file. |
||
| 68 | </p> |
||
| 69 | |||
| 70 | </div></div></div></div></div><footer><div id="footer"> |
||
| 71 | Copyright © 1999-2025, The Apache Software Foundation |
||
| 72 | <br> |
||
| 73 | Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo |
||
| 74 | are either registered trademarks or trademarks of the Apache Software |
||
| 75 | Foundation. |
||
| 76 | </div></footer></div></body></html> |