Inside Tomcat: Uncovering Its Architecture and Startup Process

This article explores Tomcat's dominant market share, its modular top‑level structure of Server, Service, Connector and Container, and details the step‑by‑step startup sequence from Bootstrap through Catalina to the Server and Service components.

Java Backend Technology
Java Backend Technology
Java Backend Technology
Inside Tomcat: Uncovering Its Architecture and Startup Process

In 2016 Tomcat became the most popular Java EE application server, holding about 58.22% of the market share among 1240 surveyed JVMs.

1. Tomcat Server Top‑Level Structure

Tomcat is highly modular; its core components are Server, Service, Connector, and Container. A Server can contain multiple Services, each Service includes one Container and one or more Connectors.

The top‑level Server represents the whole server instance. Each Service provides specific services and consists of a Connector (handling socket communication, request and response conversion) and a Container (managing Servlets and processing requests).

Connector: processes connection‑related tasks and converts sockets to Request/Response objects.

Container: encapsulates and manages Servlets, handling incoming requests.

A Tomcat instance has a single Server, which can host multiple Services; each Service has one Container but may have multiple Connectors to support protocols like HTTP and HTTPS.

The hierarchical relationships are defined in conf/server.xml. Below is a cleaned version of a typical server.xml for Tomcat 8.0.

For the full configuration file, refer to the official Tomcat documentation.

2. Tomcat Startup Process

The startup sequence is illustrated in the following diagram.

The entry point is the main method in the Bootstrap class, which delegates to the Catalina class for actual management.

2.1 Bootstrap Startup Process

The Bootstrap main method creates a Bootstrap instance and calls init(). The init() method sets up a custom ClassLoader and creates a Catalina instance (assigned to catalinaDaemon) for further command execution.

During initialization, reflection is used to invoke setAwait, load, and start on the Catalina instance.

2.2 Catalina Startup Process

Catalina

calls setAwait (to decide whether to wait after startup), load (to parse server.xml and create the Server object), and start (to launch the server).

2.3 Server Startup Process

public interface Server extends Lifecycle { }

The Server interface defines methods such as addService, findService, and removeService. Its default implementation is org.apache.catalina.core.StandardServer, whose initInternal and startInternal methods iterate over all Services to initialize and start them.

2.4 Service Startup Process

public interface Service extends Lifecycle { }

The default implementation org.apache.catalina.core.StandardService mirrors the Server hierarchy. Its initInternal and startInternal methods initialize and start the Container, Executors, MapperListener, and Connectors.

MapperListener monitors Container changes, while Executors manage thread pools for Connectors (default configuration is commented out in server.xml).

3. Summary

The article outlines Tomcat’s overall architecture, emphasizing that a single Server contains multiple Services, each Service has one Container and can have multiple Connectors, and describes the detailed startup flow from Bootstrap through Catalina to the Server and Service components.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

backend-developmentServer ArchitectureJava EEServlet Container
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.