{"id":117915,"date":"2023-07-06T15:39:50","date_gmt":"2023-07-06T12:39:50","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=117915"},"modified":"2023-12-12T11:23:42","modified_gmt":"2023-12-12T09:23:42","slug":"starting-with-apache-tomcat-cheatsheet","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html","title":{"rendered":"Starting with Apache Tomcat Cheatsheet"},"content":{"rendered":"<h2 class=\"wp-block-heading\">1. Introduction<\/h2>\n<p>Apache Tomcat, also known as Tomcat Server, is an open-source Java servlet container developed by the Apache Software Foundation. It provides a pure Java HTTP web server environment to run Java applications that use Java Servlet, JavaServer Pages (JSP), and Java Expression Language (EL). Tomcat is widely used as a web server and application server for Java-based web applications.<\/p>\n<h3 class=\"wp-block-heading\">1.1. Features of Apache Tomcat<\/h3>\n<p>Apache Tomcat offers a range of features that make it a popular choice for deploying Java web applications. Some of the key features include:<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Feature<\/strong><\/td>\n<td><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Servlet Container<\/td>\n<td>Tomcat provides a runtime environment for Java servlets, allowing you to run web applications built using the Servlet API.<\/td>\n<\/tr>\n<tr>\n<td>JavaServer Pages (JSP) Support<\/td>\n<td>Tomcat supports JSP, a technology that allows you to embed Java code inside HTML pages to generate dynamic web content.<\/td>\n<\/tr>\n<tr>\n<td>Java Expression Language (EL)<\/td>\n<td>Tomcat includes EL, a scripting language used to evaluate expressions in JSPs and JavaServer Faces (JSF) applications.<\/td>\n<\/tr>\n<tr>\n<td>HTTP Web Server<\/td>\n<td>Tomcat can function as a standalone web server, serving static web content such as HTML, CSS, and JavaScript files.<\/td>\n<\/tr>\n<tr>\n<td>Security<\/td>\n<td>Tomcat offers various security features, including user authentication, SSL\/TLS support, and access control mechanisms.<\/td>\n<\/tr>\n<tr>\n<td>Clustering and Load Balancing<\/td>\n<td>Tomcat supports clustering and load balancing to distribute the application load across multiple instances for improved performance and scalability.<\/td>\n<\/tr>\n<tr>\n<td>Embeddable<\/td>\n<td>Tomcat can be embedded within other Java applications, allowing you to use it as an integrated component.<\/td>\n<\/tr>\n<tr>\n<td>Extensibility<\/td>\n<td>Tomcat is highly extensible, with support for additional components and features through its modular architecture.<\/td>\n<\/tr>\n<tr>\n<td>Community Support<\/td>\n<td>Tomcat has a large and active community, providing regular updates, bug fixes, and support through forums and mailing lists.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h3 class=\"wp-block-heading\">1.2. Tomcat Architecture<\/h3>\n<p>To understand how Apache Tomcat works, it&#8217;s essential to have a basic understanding of its architecture. At a high level, Tomcat follows a client-server architecture, where the client sends HTTP requests, and Tomcat serves those requests by executing Java servlets and JSPs.<\/p>\n<p>Here is a brief overview of the key components of Tomcat&#8217;s architecture:<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Feature<\/strong><\/td>\n<td><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Connector<\/td>\n<td>The Connector is responsible for accepting incoming client connections and translating them into a format that Tomcat can understand.<\/td>\n<\/tr>\n<tr>\n<td>Catalina<\/td>\n<td>Catalina is the core servlet container of Tomcat. It handles the lifecycle of servlets, manages the request-response cycle, and more.<\/td>\n<\/tr>\n<tr>\n<td>Container<\/td>\n<td>The Container manages the execution of servlets and JSPs, providing an environment for servlet execution and configuration management.<\/td>\n<\/tr>\n<tr>\n<td>Web Applications<\/td>\n<td>Tomcat can host multiple web applications, each with its own context path and configuration.<\/td>\n<\/tr>\n<tr>\n<td>Valves and Filters<\/td>\n<td>Tomcat supports Valves and Filters for intercepting requests and responses to perform additional processing.<\/td>\n<\/tr>\n<tr>\n<td>Realm<\/td>\n<td>Tomcat uses Realms for authentication and authorization, defining repositories of users and their associated roles.<\/td>\n<\/tr>\n<tr>\n<td>Server<\/td>\n<td>The Server represents the top-level container in Tomcat&#8217;s architecture, managing multiple Service instances and their lifecycles.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>Now that we have covered the basics of Apache Tomcat and its architecture, let&#8217;s move on to the installation process in the next section.<\/p>\n<h2 class=\"wp-block-heading\">2. Installing Apache Tomcat<\/h2>\n<p>Installing Apache Tomcat is a straightforward process. In this section, we will guide you through the steps to install Tomcat on your system.<\/p>\n<h3 class=\"wp-block-heading\">2.1. Prerequisites<\/h3>\n<p>Before installing Apache Tomcat, make sure you have the following prerequisites:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Java Development Kit (JDK)<\/strong>: Tomcat requires a JDK to run. Ensure that you have a compatible JDK installed on your system. You can download the JDK from the official Oracle website or use a package manager if you are on a Linux distribution.<\/li>\n<li><strong>Operating System<\/strong>: Apache Tomcat is compatible with various operating systems, including Windows, Linux, and macOS. Make sure you have a supported operating system installed.<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">2.2. Downloading Apache Tomcat<\/h3>\n<p>To download Apache Tomcat, follow these steps:<\/p>\n<p>Open your web browser and visit the official Apache Tomcat website at <a href=\"https:\/\/tomcat.apache.org\/\">https:\/\/tomcat.apache.org\/<\/a>.<\/p>\n<p>Navigate to the &#8220;Downloads&#8221; section of the website.<\/p>\n<p>Choose the version of Tomcat you want to download. It is recommended to download the latest stable version unless you have specific requirements for an older version.<\/p>\n<p>Select the distribution package that matches your operating system and architecture. The two most common distributions are the &#8220;tar.gz&#8221; package for Linux\/macOS and the &#8220;zip&#8221; package for Windows.<\/p>\n<p>Click on the download link to start the download. The package will be saved to your local machine.<\/p>\n<h3 class=\"wp-block-heading\">2.3. Installing Apache Tomcat<\/h3>\n<p>Once you have downloaded the Apache Tomcat distribution package, follow the instructions below to install it:<\/p>\n<p><strong>Windows<\/strong>:<\/p>\n<p>Extract the contents of the downloaded zip package to a directory of your choice. You can use a tool like WinZip or 7-Zip to extract the files.<\/p>\n<p>After extracting the files, navigate to the Tomcat installation directory. You should see a folder named &#8220;apache-tomcat-{version}&#8221;, where &#8220;{version}&#8221; represents the version number of Tomcat you downloaded.<\/p>\n<p>In the installation directory, locate the &#8220;bin&#8221; folder. This folder contains various scripts and executables for managing Tomcat.<\/p>\n<p>To start Tomcat, double-click on the &#8220;startup.bat&#8221; file. This will launch Tomcat and start the server.<\/p>\n<p>To verify if Tomcat is running correctly, open a web browser and visit <a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a>. If Tomcat is running, you should see the default Tomcat homepage.<\/p>\n<p><strong>Linux\/macOS<\/strong>:<\/p>\n<p>Open a terminal and navigate to the directory where you downloaded the Tomcat distribution package.<\/p>\n<p>Extract the package using the appropriate command based on the package format. For a &#8220;tar.gz&#8221; package, use the following command:<\/p>\n<pre class=\"brush:bash\">   tar -xzvf apache-tomcat-{version}.tar.gz<\/pre>\n<p>After extracting the files, navigate to the Tomcat installation directory. You should see a folder named &#8220;apache-tomcat-{version}&#8221;, where &#8220;{version}&#8221; represents the version number of Tomcat you downloaded.<\/p>\n<p>In the installation directory, locate the &#8220;bin&#8221; folder. This folder contains various scripts and executables for managing Tomcat.<\/p>\n<p>To start Tomcat, run the following command:<\/p>\n<pre class=\"brush:bash\">   .\/startup.sh<\/pre>\n<p>To verify if Tomcat is running correctly, open a web browser and visit <a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a>. If Tomcat is running, you should see the default Tomcat homepage.<\/p>\n<h2 class=\"wp-block-heading\">3. Running Apache Tomcat<\/h2>\n<p>After installing Apache Tomcat, you can start the server and access your web applications. In this section, we will explore different ways to run Tomcat and access its management interfaces.<\/p>\n<h3 class=\"wp-block-heading\">3.1. Starting Tomcat<\/h3>\n<p>To start Tomcat, follow these steps:<\/p>\n<p>Open a terminal or command prompt.<\/p>\n<p>Navigate to the Tomcat installation directory.<\/p>\n<p>Inside the &#8220;bin&#8221; directory, run the appropriate startup script for your operating system:<\/p>\n<ul class=\"wp-block-list\">\n<li>On Windows: Run <code>startup.bat<\/code><\/li>\n<li>On Linux\/macOS: Run <code>.\/startup.sh<\/code><\/li>\n<\/ul>\n<p>Tomcat will start, and you should see the server logs in the terminal or command prompt window.<\/p>\n<h3 class=\"wp-block-heading\">3.2. Accessing the Default Tomcat Homepage<\/h3>\n<p>Once Tomcat is running, you can access the default Tomcat homepage to verify its installation.<\/p>\n<p>Open a web browser.<\/p>\n<p>Enter the following URL in the address bar:<\/p>\n<pre class=\"brush:javascript\">   http:&#47;&#47;localhost:8080\/<\/pre>\n<p>If Tomcat is running correctly, you should see the default Tomcat homepage.<\/p>\n<h3 class=\"wp-block-heading\">3.3. Accessing the Tomcat Manager Interface<\/h3>\n<p>The Tomcat Manager interface allows you to manage web applications deployed on Tomcat. By default, this interface is protected with a username and password.<\/p>\n<p>Open a web browser.<\/p>\n<p>Enter the following URL in the address bar:<\/p>\n<pre class=\"brush:javascript\">   http:&#47;&#47;localhost:8080\/manager<\/pre>\n<p>You will be prompted to enter a username and password. The default credentials are:<\/p>\n<ul class=\"wp-block-list\">\n<li>Username: <code>admin<\/code><\/li>\n<li>Password: <code>admin<\/code><\/li>\n<\/ul>\n<p>After successfully logging in, you will see the Tomcat Manager interface, where you can deploy, undeploy, start, and stop web applications.<\/p>\n<p>Note: It is recommended to change the default credentials for the Tomcat Manager interface to enhance security.<\/p>\n<h3 class=\"wp-block-heading\">3.4 Accessing the Host Manager Interface<\/h3>\n<p>The Host Manager interface provides a graphical interface for managing virtual hosts in Tomcat. Similar to the Tomcat Manager interface, the Host Manager interface is protected with a username and password.<\/p>\n<p>Open a web browser.<\/p>\n<p>Enter the following URL in the address bar:<\/p>\n<pre class=\"brush:javascript\">   http:&#47;&#47;localhost:8080\/host-manager<\/pre>\n<p>You will be prompted to enter a username and password. The default credentials are the same as the Tomcat Manager interface:<\/p>\n<ul class=\"wp-block-list\">\n<li>Username: <code>admin<\/code><\/li>\n<li>Password: <code>admin<\/code><\/li>\n<\/ul>\n<p>After successful authentication, you will see the Host Manager interface, where you can add, remove, and manage virtual hosts.<\/p>\n<p>Note: It is recommended to change the default credentials for the Host Manager interface to enhance security.<\/p>\n<h2 class=\"wp-block-heading\">4. Configuring Apache Tomcat<\/h2>\n<p>Apache Tomcat provides a wide range of configuration options to customize its behavior. In this section, we will cover some of the essential configuration files and settings that you may need to modify.<\/p>\n<h3 class=\"wp-block-heading\">4.1. Server Configuration<\/h3>\n<p>The server configuration in Tomcat is defined in the <code>server.xml<\/code> file, located in the <code>conf<\/code> directory of your Tomcat installation. This file contains the global configuration settings for the Tomcat server.<\/p>\n<p>To modify the server configuration:<\/p>\n<p>Navigate to the <code>conf<\/code> directory of your Tomcat installation.<\/p>\n<p>Open the <code>server.xml<\/code> file in a text editor.<\/p>\n<p>Make the necessary changes to the configuration settings. Here are a few common settings you may want to modify:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Port Numbers<\/strong>: Tomcat listens on different ports for different protocols. You can change the default port numbers for HTTP, HTTPS, AJP, and other connectors.<\/li>\n<li><strong>Executor<\/strong>: The executor element defines the thread pool configuration for Tomcat. You can adjust the thread pool size and other settings to optimize performance.<\/li>\n<li><strong>Global Resources<\/strong>: Tomcat allows you to define global resources such as database connections, JMS resources, and more. You can configure these resources in the <code>&lt;GlobalNamingResources&gt;<\/code> section.<\/li>\n<li><strong>Logging<\/strong>: Tomcat uses the Java Util Logging framework for logging. You can configure the logging levels and log file locations in the <code>&lt;Valve&gt;<\/code> elements within the <code>&lt;Engine&gt;<\/code> section.<\/li>\n<\/ul>\n<p>Save the <code>server.xml<\/code> file.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Restart Tomcat for the changes to take effect.<\/p>\n<p>Note: When modifying the server configuration, be cautious and ensure that you understand the implications of the changes. Backup the original <code>server.xml<\/code> file before making any modifications.<\/p>\n<h3 class=\"wp-block-heading\">4.2. Context Configuration<\/h3>\n<p>The context configuration in Tomcat allows you to define specific settings for individual web applications. Each web application deployed in Tomcat has its own context configuration file named <code>context.xml<\/code>, located in the <code>conf<\/code> directory or the <code>META-INF<\/code> directory of the application.<\/p>\n<p>To modify the context configuration for a web application:<\/p>\n<p>Locate the <code>context.xml<\/code> file for the web application you want to configure.<\/p>\n<p>Open the <code>context.xml<\/code> file in a text editor.<\/p>\n<p>Make the necessary changes to the configuration settings. Here are a few common settings you may want to modify:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Data Sources<\/strong>: If your web application requires database access, you can configure data sources in the <code>&lt;Resource&gt;<\/code> elements. Specify the database connection properties such as the URL, username, password, and driver class.<\/li>\n<li><strong>Environment Variables<\/strong>: You can define environment variables specific to your web application using the <code>&lt;Environment&gt;<\/code> element. These variables can be accessed from your application code using the JNDI API.<\/li>\n<\/ul>\n<p>Save the <code>context.xml<\/code> file.<\/p>\n<p>Restart Tomcat or reload the web application for the changes to take effect.<\/p>\n<p>Note: Modifying the context configuration directly in the <code>context.xml<\/code> file is not always recommended, especially if you want to preserve the configuration across different deployments. Instead, you can use context-specific configuration files or the Tomcat Manager interface to manage the context configuration.<\/p>\n<h3 class=\"wp-block-heading\">4.3. Logging Configuration<\/h3>\n<p>Tomcat uses the Java Util Logging framework for logging. The logging configuration is defined in the <code>logging.properties<\/code> file, located in the <code>conf<\/code> directory of your Tomcat installation. This file specifies the logging levels, log file locations, and other logging-related settings.<\/p>\n<p>To modify the logging configuration:<\/p>\n<p>Navigate to the <code>conf<\/code> directory of your Tomcat installation.<\/p>\n<p>Open the <code>logging.properties<\/code> file in a text editor.<\/p>\n<p>Make the necessary changes to the logging settings. Here are a few common settings you may want to modify:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Log Levels<\/strong>: Adjust the log levels for various Tomcat components, such as the Catalina, Host, and Context loggers. You can set the log levels to control the verbosity of the logs.<\/li>\n<li><strong>Log Handlers<\/strong>: Specify the log handlers and their associated properties. Tomcat supports different log handlers, such as <code>java.util.logging.ConsoleHandler<\/code> for console logging and <code>java.util.logging.FileHandler<\/code> for file logging.<\/li>\n<\/ul>\n<p>Save the <code>logging.properties<\/code> file.<\/p>\n<p>Restart Tomcat for the changes to take effect.<\/p>\n<p>Note: You can also configure logging programmatically within your web application using the logging framework of your choice (e.g., Log4j, SLF4J). Consult the documentation of the logging framework for detailed instructions on configuring logging within your application.<\/p>\n<h2 class=\"wp-block-heading\">5. Deploying Web Applications<\/h2>\n<p>Apache Tomcat provides several methods for deploying web applications. In this section, we will cover the most common approaches to deploy your web applications to Tomcat.<\/p>\n<h3 class=\"wp-block-heading\">5.1. Manual Deployment<\/h3>\n<p>The manual deployment method involves manually copying your web application files to a specific location in the Tomcat directory structure. This method is suitable for small-scale deployments or when you have direct access to the Tomcat server.<\/p>\n<p>To manually deploy a web application:<\/p>\n<p>Build your web application into a WAR (Web Application Archive) file. The WAR file is a compressed file format that contains all the necessary files for your web application.<\/p>\n<p>Locate the <code>webapps<\/code> directory in your Tomcat installation. This directory is the default location for deploying web applications.<\/p>\n<p>Copy the WAR file of your web application to the <code>webapps<\/code> directory.<\/p>\n<p>Tomcat will automatically deploy the web application. It will extract the contents of the WAR file and create a corresponding directory with the same name as the WAR file (excluding the <code>.war<\/code> extension).<\/p>\n<p>Once the deployment is complete, you can access your web application by using the context path, which is derived from the name of the WAR file or the corresponding directory.<\/p>\n<h3 class=\"wp-block-heading\">5.2. Manager Application Deployment<\/h3>\n<p>Apache Tomcat provides a web-based manager application that allows you to deploy, undeploy, start, and stop web applications. The manager application is protected with a username and password.<\/p>\n<p>To deploy a web application using the manager application:<\/p>\n<p>Access the Tomcat Manager interface by visiting <a href=\"http:\/\/localhost:8080\/manager\">http:\/\/localhost:8080\/manager<\/a> in a web browser.<\/p>\n<p>Log in using the credentials for the Tomcat Manager interface (default username: <code>admin<\/code>, default password: <code>admin<\/code>).<\/p>\n<p>In the Tomcat Manager interface, navigate to the &#8220;WAR file to deploy&#8221; section.<\/p>\n<p>Click on the &#8220;Choose File&#8221; button and select the WAR file of your web application.<\/p>\n<p>Click on the &#8220;Deploy&#8221; button to deploy the web application.<\/p>\n<p>Tomcat will automatically deploy the web application. Once the deployment is complete, you will see the web application listed in the Tomcat Manager interface.<\/p>\n<p>Note: The manager application also provides options to undeploy, start, and stop web applications. Use these options as needed to manage your deployed applications.<\/p>\n<h3 class=\"wp-block-heading\">5.3. Context XML Deployment<\/h3>\n<p>The Context XML deployment method allows you to configure the deployment settings for a web application using a separate XML file. This method provides more flexibility and control over the deployment process.<\/p>\n<p>To deploy a web application using a Context XML file:<\/p>\n<p>Create a new XML file with a <code>.xml<\/code> extension in the <code>conf\/Catalina\/localhost<\/code> directory of your Tomcat installation. The name of the XML file should match the context path you want to assign to your web application. For example, if your context path is <code>\/myapp<\/code>, create a file named <code>myapp.xml<\/code>.<\/p>\n<p>Open the XML file in a text editor and define the deployment settings for your web application. Here&#8217;s an example XML configuration:<\/p>\n<pre class=\"brush:xml\">   &lt;Context docBase=\"\/path\/to\/myapp\" path=\"\/myapp\" reloadable=\"true\">&lt;\/Context><\/pre>\n<ul class=\"wp-block-list\">\n<li>The <code>docBase<\/code> attribute specifies the file system path or the WAR file location of your web application.<\/li>\n<li>The <code>path<\/code> attribute defines the context path for your web application.<\/li>\n<li>The <code>reloadable<\/code> attribute specifies whether the web application should be reloaded automatically when the underlying files change. Set it to <code>\"true\"<\/code> for development purposes.<\/li>\n<\/ul>\n<p>Save the XML file.<\/p>\n<p>Restart Tomcat or reload the application for the changes to take effect.<\/p>\n<p>Note: The Context XML deployment method provides more advanced configuration options, such as specifying data sources, resource links, and more. Refer to the Apache Tomcat documentation for a detailed explanation of the available configuration options.<\/p>\n<h2 class=\"wp-block-heading\">6. Managing Web Applications<\/h2>\n<p>Once you have deployed web applications to Apache Tomcat, you may need to manage and perform various operations on them. In this section, we will cover common tasks related to managing web applications.<\/p>\n<h3 class=\"wp-block-heading\">6.1. Starting and Stopping Web Applications<\/h3>\n<p>Apache Tomcat allows you to start and stop individual web applications. When a web application is started, it becomes accessible to users. When stopped, it is no longer available.<\/p>\n<p>To start or stop a web application using the Tomcat Manager interface:<\/p>\n<p>Access the Tomcat Manager interface by visiting <a href=\"http:\/\/localhost:8080\/manager\">http:\/\/localhost:8080\/manager<\/a> in a web browser.<\/p>\n<p>Log in using the credentials for the Tomcat Manager interface (default username: <code>admin<\/code>, default password: <code>admin<\/code>).<\/p>\n<p>In the Tomcat Manager interface, locate the web application you want to start or stop.<\/p>\n<p>Click on the &#8220;Start&#8221; or &#8220;Stop&#8221; button corresponding to the web application.<\/p>\n<p>Tomcat will start or stop the web application accordingly.<\/p>\n<h3 class=\"wp-block-heading\">6.2. Undeploying Web Applications<\/h3>\n<p>To remove a web application from Apache Tomcat, you can undeploy it. Undeploying a web application removes its associated files and frees up the resources occupied by the application.<\/p>\n<p>To undeploy a web application using the Tomcat Manager interface:<\/p>\n<p>Access the Tomcat Manager interface by visiting <a href=\"http:\/\/localhost:8080\/manager\">http:\/\/localhost:8080\/manager<\/a> in a web browser.<\/p>\n<p>Log in using the credentials for the Tomcat Manager interface (default username: <code>admin<\/code>, default password: <code>admin<\/code>).<\/p>\n<p>In the Tomcat Manager interface, locate the web application you want to undeploy.<\/p>\n<p>Click on the &#8220;Undeploy&#8221; button corresponding to the web application.<\/p>\n<p>Tomcat will undeploy the web application and remove its associated files.<\/p>\n<h3 class=\"wp-block-heading\">6.3. Reloading Web Applications<\/h3>\n<p>During development, it is often convenient to automatically reload a web application whenever changes are made to its underlying files. Apache Tomcat provides the ability to enable automatic reloading for web applications.<\/p>\n<p>To enable automatic reloading for a web application:<\/p>\n<p>Locate the <code>context.xml<\/code> file of the web application. The <code>context.xml<\/code> file is located in the <code>conf\/Catalina\/localhost<\/code> directory or within the application&#8217;s <code>META-INF<\/code> directory.<\/p>\n<p>Open the <code>context.xml<\/code> file in a text editor.<\/p>\n<p>Add the <code>reloadable<\/code> attribute to the <code>&lt;Context&gt;<\/code> element and set it to <code>\"true\"<\/code>. For example:<\/p>\n<pre class=\"brush:xml\">   &lt;Context reloadable=\"true\">&lt;\/Context><\/pre>\n<p>Save the <code>context.xml<\/code> file.<\/p>\n<p>Restart Tomcat or reload the web application for the changes to take effect.<\/p>\n<p>With automatic reloading enabled, Tomcat will monitor the web application&#8217;s files, and whenever a change is detected, it will automatically reload the application without requiring a manual restart.<\/p>\n<p>[ulp id=&#8217;WsaglsBvxqGU6jpv-14&#8242;]<br \/>\n&nbsp;<\/p>\n<h3 class=\"wp-block-heading\">6.4. Managing Web Applications via Configuration Files<\/h3>\n<p>Apache Tomcat allows you to manage web applications through configuration files as well. By modifying the configuration files, you can control various aspects of the application, such as its deployment, startup order, security settings, and more.<\/p>\n<p>Here are some of the configuration files related to managing web applications in Tomcat:<\/p>\n<ul class=\"wp-block-list\">\n<li><code>server.xml<\/code>: The main configuration file for the Tomcat server. It contains server-level configuration settings that can affect all web applications.<\/li>\n<li><code>context.xml<\/code>: The context configuration file for individual web applications. It allows you to define application-specific settings, such as data sources, environment variables, and more.<\/li>\n<li><code>web.xml<\/code>: The deployment descriptor file for a web application. It provides configuration settings for the web application, including servlet mappings, filter configurations, security constraints, and more.<\/li>\n<\/ul>\n<p>By modifying these configuration files, you can customize the behavior of web applications deployed in Tomcat.<\/p>\n<h2 class=\"wp-block-heading\">7. Securing Apache Tomcat<\/h2>\n<p>Securing your Apache Tomcat server is essential to protect your web applications and sensitive data. In this section, we will discuss various security measures you can implement to enhance the security of your Tomcat server.<\/p>\n<h3 class=\"wp-block-heading\">7.1. Changing Default Credentials<\/h3>\n<p>By default, Apache Tomcat uses the username <code>admin<\/code> and password <code>admin<\/code> for the Tomcat Manager and Host Manager interfaces. It is crucial to change these default credentials to prevent unauthorized access to the management interfaces.<\/p>\n<p>To change the default credentials:<\/p>\n<p>Access the <code>tomcat-users.xml<\/code> file located in the <code>conf<\/code> directory of your Tomcat installation.<\/p>\n<p>Open the <code>tomcat-users.xml<\/code> file in a text editor.<\/p>\n<p>Locate the <code>&lt;tomcat-users&gt;<\/code> element.<\/p>\n<p>Add or modify the <code>&lt;user&gt;<\/code> element to define a new user with a secure username and password. For example:<\/p>\n<pre class=\"brush:xml\">   &lt;tomcat-users>\n     ...\n     &lt;user username=\"newuser\" password=\"newpassword\" roles=\"manager-gui,admin-gui\"\/>\n     ...\n   &lt;\/tomcat-users><\/pre>\n<ul class=\"wp-block-list\">\n<li>Replace <code>\"newuser\"<\/code> with a secure username of your choice.<\/li>\n<li>Replace <code>\"newpassword\"<\/code> with a strong password for the user.<\/li>\n<li>The <code>roles<\/code> attribute specifies the roles assigned to the user. In this example, the user has <code>manager-gui<\/code> and <code>admin-gui<\/code> roles, which provide access to the Tomcat Manager and Host Manager interfaces.<\/li>\n<\/ul>\n<p>Save the <code>tomcat-users.xml<\/code> file.<\/p>\n<p>Restart Tomcat for the changes to take effect.<\/p>\n<h3 class=\"wp-block-heading\">7.2. Restricting Access to Management Interfaces<\/h3>\n<p>To further enhance security, you can restrict access to the Tomcat Manager and Host Manager interfaces to specific IP addresses or networks. This prevents unauthorized access from external sources.<\/p>\n<p>To restrict access to the management interfaces:<\/p>\n<p>Access the <code>web.xml<\/code> file located in the <code>webapps\/manager\/WEB-INF<\/code> directory of your Tomcat installation.<\/p>\n<p>Open the <code>web.xml<\/code> file in a text editor.<\/p>\n<p>Locate the <code>&lt;security-constraint&gt;<\/code> element.<\/p>\n<p>Modify the <code>&lt;web-resource-collection&gt;<\/code> element to specify the restricted IP addresses or networks. For example:<\/p>\n<pre class=\"brush:xml\">   &lt;web-resource-collection>\n     &lt;web-resource-name>Restricted Manager&lt;\/web-resource-name>\n     &lt;url-pattern>\/*&lt;\/url-pattern>\n     &lt;http-method>GET&lt;\/http-method>\n     &lt;http-method>POST&lt;\/http-method>\n     &lt;http-method>PUT&lt;\/http-method>\n     ...\n     &lt;ip-address>127.0.0.1&lt;\/ip-address>\n     &lt;ip-address>192.168.0.0\/24&lt;\/ip-address>\n   &lt;\/web-resource-collection><\/pre>\n<ul class=\"wp-block-list\">\n<li>Replace the <code>&lt;ip-address&gt;<\/code> elements with the IP addresses or networks you want to allow access from.<\/li>\n<\/ul>\n<p>Save the <code>web.xml<\/code> file.<\/p>\n<p>Repeat the same steps for the <code>web.xml<\/code> file located in the <code>webapps\/host-manager\/WEB-INF<\/code> directory if you want to restrict access to the Host Manager interface as well.<\/p>\n<p>Restart Tomcat for the changes to take effect.<\/p>\n<p>With access restrictions in place, only the specified IP addresses or networks will be able to access the management interfaces.<\/p>\n<h3 class=\"wp-block-heading\">7.3. SSL\/TLS Configuration<\/h3>\n<p>Enabling SSL\/TLS encryption for Apache Tomcat is crucial to secure the communication between clients and the server. SSL\/TLS ensures that data transmitted over the network remains confidential and cannot be intercepted or tampered with.<\/p>\n<p>To configure SSL\/TLS for Apache Tomcat:<\/p>\n<p>Obtain an SSL\/TLS certificate from a trusted certificate authority (CA) or create a self-signed certificate.<\/p>\n<p>Access the <code>server.xml<\/code> file located in the <code>conf<\/code> directory of your Tomcat installation.<\/p>\n<p>Locate the <code>&lt;Connector&gt;<\/code> element for the HTTP connector.<\/p>\n<p>Add a new <code>&lt;Connector&gt;<\/code> element for the HTTPS connector, specifying the SSL\/TLS configuration. For example:<\/p>\n<pre class=\"brush:xml\">   &lt;Connector port=\"443\" protocol=\"HTTP\/1.1\" SSLEnabled=\"true\"\n              maxThreads=\"150\" scheme=\"https\" secure=\"true\"\n              keystoreFile=\"\/path\/to\/keystore\" keystorePass=\"password\"\n              clientAuth=\"false\" sslProtocol=\"TLS\"\/><\/pre>\n<ul class=\"wp-block-list\">\n<li>Replace <code>\"\/path\/to\/keystore\"<\/code> with the path to your keystore file.<\/li>\n<li>Replace <code>\"password\"<\/code> with the password for the keystore.<\/li>\n<\/ul>\n<p>Save the <code>server.xml<\/code> file.<\/p>\n<p>Restart Tomcat for the changes to take effect.<\/p>\n<p>Access your web applications using the HTTPS protocol (e.g., <code>https:\/\/localhost:443\/myapp<\/code>).<\/p>\n<p>By configuring SSL\/TLS, you ensure that the communication between clients and the Tomcat server is encrypted and secure.<\/p>\n<h3 class=\"wp-block-heading\">7.4. Access Control and Authorization<\/h3>\n<p>Apache Tomcat provides various mechanisms for access control and authorization to secure your web applications. You can restrict access to specific resources based on user roles, define security constraints, and more.<\/p>\n<p>To implement access control and authorization:<\/p>\n<p>Access the <code>web.xml<\/code> file of your web application located in the <code>WEB-INF<\/code> directory.<\/p>\n<p>Configure security constraints by adding <code>&lt;security-constraint&gt;<\/code> elements. Specify the URL patterns and the required roles to access those resources. For example:<\/p>\n<pre class=\"brush:xml\">   &lt;security-constraint>\n     &lt;web-resource-collection>\n       &lt;web-resource-name>Protected Resources&lt;\/web-resource-name>\n       &lt;url-pattern>\/secure\/*&lt;\/url-pattern>\n     &lt;\/web-resource-collection>\n     &lt;auth-constraint>\n       &lt;role-name>ROLE_ADMIN&lt;\/role-name>\n     &lt;\/auth-constraint>\n   &lt;\/security-constraint><\/pre>\n<ul class=\"wp-block-list\">\n<li>Replace <code>\"\/secure\/*\"<\/code> with the URL pattern of the resources you want to protect.<\/li>\n<li>Replace <code>\"ROLE_ADMIN\"<\/code> with the required role(s) that users must have to access those resources.<\/li>\n<\/ul>\n<p>Define the roles and their corresponding users in the <code>tomcat-users.xml<\/code> file located in the <code>conf<\/code> directory. For example:<\/p>\n<pre class=\"brush:xml\">   &lt;role rolename=\"ROLE_ADMIN\"\/>\n   &lt;user username=\"admin\" password=\"password\" roles=\"ROLE_ADMIN\"\/><\/pre>\n<ul class=\"wp-block-list\">\n<li>Replace <code>\"admin\"<\/code> and <code>\"password\"<\/code> with the appropriate username and password.<\/li>\n<\/ul>\n<p>Save the <code>web.xml<\/code> and <code>tomcat-users.xml<\/code> files.<\/p>\n<p>Restart Tomcat or reload the web application for the changes to take effect.<\/p>\n<p>With access control and authorization in place, only users with the required roles will be able to access the protected resources.<\/p>\n<h2 class=\"wp-block-heading\">8. Monitoring and Troubleshooting<\/h2>\n<p>Monitoring and troubleshooting are essential aspects of managing an Apache Tomcat server. In this section, we will discuss techniques and tools you can use to monitor and troubleshoot Tomcat.<\/p>\n<h3 class=\"wp-block-heading\">8.1. Server Logs<\/h3>\n<p>Tomcat generates several log files that provide valuable information about the server&#8217;s operation and the deployed web applications. Monitoring and analyzing these logs can help identify issues and troubleshoot problems.<\/p>\n<p>Here are some of the important log files in Tomcat:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>catalina.out<\/strong> (or <strong>catalina.log<\/strong>): This file contains the standard output and error messages from Tomcat. It includes information about Tomcat&#8217;s startup, shutdown, and other runtime activities.<\/li>\n<li><strong>localhost.log<\/strong>: This file contains log messages related to the web applications deployed on the &#8220;localhost&#8221; virtual host.<\/li>\n<li><strong>host-manager.log<\/strong>: This file contains log messages related to the Host Manager application.<\/li>\n<li><strong>manager.log<\/strong>: This file contains log messages related to the Tomcat Manager application.<\/li>\n<li><strong>[webapp-name].log<\/strong>: Each deployed web application may have its own log file named after the web application&#8217;s context path. For example, if your web application has a context path of &#8220;\/myapp&#8221;, the log file will be named &#8220;myapp.log&#8221;.<\/li>\n<\/ul>\n<p>You can find these log files in the <code>logs<\/code> directory of your Tomcat installation. Monitor these log files to identify errors, exceptions, and other issues that may occur during the operation of Tomcat and your web applications.<\/p>\n<h3 class=\"wp-block-heading\">8.2. Tomcat Manager Status<\/h3>\n<p>The Tomcat Manager interface provides a status page that displays information about the running web applications, server uptime, memory usage, and more. Monitoring the Tomcat Manager status page can give you an overview of the server&#8217;s health and performance.<\/p>\n<p>To access the Tomcat Manager status page:<\/p>\n<p>Open a web browser.<\/p>\n<p>Enter the following URL in the address bar:<\/p>\n<pre class=\"brush:javascript\">   http:&#47;&#47;localhost:8080\/manager\/status<\/pre>\n<p>You will be prompted to enter a username and password. Enter the credentials for the Tomcat Manager interface.<\/p>\n<p>After successfully logging in, you will see the Tomcat Manager status page with detailed information about the server and the deployed web applications.<\/p>\n<p>Monitor the status page to keep track of the server&#8217;s resource usage, active sessions, and other important metrics.<\/p>\n<h3 class=\"wp-block-heading\">8.3. JMX Monitoring<\/h3>\n<p>Java Management Extensions (JMX) is a Java technology that provides a standard way to monitor and manage Java applications. Apache Tomcat exposes various MBeans (Managed Beans) through JMX, allowing you to monitor and control the server&#8217;s behavior.<\/p>\n<p>You can use JMX-compatible monitoring tools, such as JConsole or VisualVM, to connect to Tomcat&#8217;s JMX server and retrieve information about the server&#8217;s performance, memory usage, thread pool statistics, and more.<\/p>\n<p>To enable JMX monitoring in Tomcat:<\/p>\n<p>Access the <code>catalina.sh<\/code> (Linux\/macOS) or <code>catalina.bat<\/code> (Windows) file located in the <code>bin<\/code> directory of your Tomcat installation.<\/p>\n<p>Open the file in a text editor.<\/p>\n<p>Locate the <code>CATALINA_OPTS<\/code> environment variable.<\/p>\n<p>Add the following options to enable JMX monitoring:<\/p>\n<pre class=\"brush:bash\">   -Dcom.sun.management.jmxremote\n   -Dcom.sun.management.jmxremote.port=9999\n   -Dcom.sun.management.jmxremote.authenticate=false\n   -Dcom.sun.management.jmxremote.ssl=false<\/pre>\n<ul class=\"wp-block-list\">\n<li>Modify the <code>port<\/code> option to specify the desired JMX port.<\/li>\n<\/ul>\n<p>Save the <code>catalina.sh<\/code> or <code>catalina.bat<\/code> file.<\/p>\n<p>Restart Tomcat for the changes to take effect.<\/p>\n<p>Once JMX is enabled, you can use a JMX-compatible monitoring tool to connect to Tomcat&#8217;s JMX server using the specified port. From the monitoring tool, you can explore the available MBeans and monitor various aspects of Tomcat&#8217;s performance.<\/p>\n<h3 class=\"wp-block-heading\">8.4. Troubleshooting Common Issues<\/h3>\n<p>Apache Tomcat may encounter various issues during its operation. Here are some common issues and troubleshooting steps:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Server startup failure<\/strong>: If Tomcat fails to start, check the server logs (<code>catalina.out<\/code> or <code>catalina.log<\/code>) for any error messages. Ensure that the necessary environment variables, such as <code>JAVA_HOME<\/code> and <code>CATALINA_HOME<\/code>, are set correctly. Review the configuration files for any misconfigurations.<\/li>\n<li><strong>Application deployment issues<\/strong>: If a web application fails to deploy, verify that the WAR file or the application&#8217;s directory structure is correct. Check the logs for any deployment-related errors. Ensure that the necessary dependencies and resources are available.<\/li>\n<li><strong>Memory and performance problems<\/strong>: Monitor the server&#8217;s memory usage and performance metrics using tools like JConsole or VisualVM. If the server is running out of memory, consider adjusting the JVM memory settings (<code>-Xmx<\/code> and <code>-Xms<\/code> options). Review your web applications for any memory leaks or performance bottlenecks.<\/li>\n<li><strong>SSL\/TLS configuration errors<\/strong>: If you encounter issues with SSL\/TLS configuration, ensure that the keystore file and password are correct. Verify that the SSL\/TLS connector configuration in <code>server.xml<\/code> matches the keystore settings. Check the server logs for any SSL\/TLS-related errors.<\/li>\n<li><strong>Access and authentication problems<\/strong>: If you are experiencing issues with access control or authentication, review the configuration files (<code>web.xml<\/code>, <code>tomcat-users.xml<\/code>) to ensure that the roles and user credentials are correctly defined. Check the access restrictions and security constraints in the configuration files.<\/li>\n<li><strong>Connection and network issues<\/strong>: If clients are unable to connect to the server or experience network-related issues, verify that the necessary ports are open and accessible. Check firewall settings and network configurations. Ensure that the server&#8217;s IP address and hostname are correctly configured.<\/li>\n<\/ul>\n<p>When troubleshooting issues, it is often helpful to consult the Apache Tomcat documentation, search online forums and communities, and seek assistance from experienced users or Tomcat support resources.<\/p>\n<h2 class=\"wp-block-heading\">9. Additional Resources and References<\/h2>\n<p>Apache Tomcat is a powerful web server and servlet container with extensive documentation and a supportive community. Here are some additional resources and references that can help you further enhance your knowledge of Tomcat:<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Resource<\/strong><\/td>\n<td><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/tomcat.apache.org\/tomcat-8.5-doc\/index.html\">Official Apache Tomcat Documentation<\/a><\/td>\n<td>The official documentation provides comprehensive information about Tomcat&#8217;s features, configuration options, and deployment guidelines.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/tomcat.apache.org\/lists.html\">Tomcat User Mailing List<\/a><\/td>\n<td>The Tomcat user mailing list is a valuable resource for getting help, sharing experiences, and discussing topics related to Tomcat usage.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/en.wikipedia.org\/wiki\/Apache_Tomcat\">Tomcat Wiki<\/a><\/td>\n<td>The Tomcat Wiki is a community-driven resource that contains a wealth of information, tutorials, and best practices related to Tomcat.<\/td>\n<\/tr>\n<tr>\n<td>Books<\/td>\n<td>There are several books available that cover various aspects of Apache Tomcat, ranging from beginner&#8217;s guides to advanced topics.<\/td>\n<\/tr>\n<tr>\n<td>Online Forums and Communities<\/td>\n<td>Explore online forums and communities, such as Stack Overflow and the Apache Tomcat Users Group on LinkedIn, where you can ask questions and share experiences.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>Remember to refer to the official documentation and consult reliable resources when seeking information or troubleshooting issues with Apache Tomcat.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction Apache Tomcat, also known as Tomcat Server, is an open-source Java servlet container developed by the Apache Software Foundation. It provides a pure Java HTTP web server environment to run Java applications that use Java Servlet, JavaServer Pages (JSP), and Java Expression Language (EL). Tomcat is widely used as a web server and &hellip;<\/p>\n","protected":false},"author":127306,"featured_media":84,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[2100,679],"class_list":["post-117915","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-cheatsheet","tag-tomcat"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Starting with Apache Tomcat Cheatsheet - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Discover the power of Apache Tomcat with comprehensive documentation. Unlock the full potential of web application development. Explore now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Starting with Apache Tomcat Cheatsheet - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Discover the power of Apache Tomcat with comprehensive documentation. Unlock the full potential of web application development. Explore now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-06T12:39:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-12T09:23:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-tomcat-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Odysseas Mourtzoukos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Odysseas Mourtzoukos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"21 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html\"},\"author\":{\"name\":\"Odysseas Mourtzoukos\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/02453b5f72c0a67d5fff51eded4c800a\"},\"headline\":\"Starting with Apache Tomcat Cheatsheet\",\"datePublished\":\"2023-07-06T12:39:50+00:00\",\"dateModified\":\"2023-12-12T09:23:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html\"},\"wordCount\":4619,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-tomcat-logo.jpg\",\"keywords\":[\"Cheatsheet\",\"Tomcat\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html\",\"name\":\"Starting with Apache Tomcat Cheatsheet - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-tomcat-logo.jpg\",\"datePublished\":\"2023-07-06T12:39:50+00:00\",\"dateModified\":\"2023-12-12T09:23:42+00:00\",\"description\":\"Discover the power of Apache Tomcat with comprehensive documentation. Unlock the full potential of web application development. Explore now!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-tomcat-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-tomcat-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/starting-with-apache-tomcat-cheatsheet.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Starting with Apache Tomcat Cheatsheet\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/02453b5f72c0a67d5fff51eded4c800a\",\"name\":\"Odysseas Mourtzoukos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/cropped-Photo-96x96-1-96x96.jpg\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/cropped-Photo-96x96-1-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/cropped-Photo-96x96-1-96x96.jpg\",\"caption\":\"Odysseas Mourtzoukos\"},\"description\":\"Mourtzoukos Odysseas is studying to become a software engineer, at Harokopio University of Athens. Along with his studies, he is getting involved with different projects on gaming development and web applications. He is looking forward to sharing his knowledge and experience with the world.\",\"sameAs\":[\"https:\\\/\\\/www.javacodegeeks.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/odysseas-mourtzoukos\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Starting with Apache Tomcat Cheatsheet - Java Code Geeks","description":"Discover the power of Apache Tomcat with comprehensive documentation. Unlock the full potential of web application development. Explore now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html","og_locale":"en_US","og_type":"article","og_title":"Starting with Apache Tomcat Cheatsheet - Java Code Geeks","og_description":"Discover the power of Apache Tomcat with comprehensive documentation. Unlock the full potential of web application development. Explore now!","og_url":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2023-07-06T12:39:50+00:00","article_modified_time":"2023-12-12T09:23:42+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-tomcat-logo.jpg","type":"image\/jpeg"}],"author":"Odysseas Mourtzoukos","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Odysseas Mourtzoukos","Est. reading time":"21 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html"},"author":{"name":"Odysseas Mourtzoukos","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/02453b5f72c0a67d5fff51eded4c800a"},"headline":"Starting with Apache Tomcat Cheatsheet","datePublished":"2023-07-06T12:39:50+00:00","dateModified":"2023-12-12T09:23:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html"},"wordCount":4619,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-tomcat-logo.jpg","keywords":["Cheatsheet","Tomcat"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html","url":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html","name":"Starting with Apache Tomcat Cheatsheet - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-tomcat-logo.jpg","datePublished":"2023-07-06T12:39:50+00:00","dateModified":"2023-12-12T09:23:42+00:00","description":"Discover the power of Apache Tomcat with comprehensive documentation. Unlock the full potential of web application development. Explore now!","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-tomcat-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-tomcat-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/starting-with-apache-tomcat-cheatsheet.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Starting with Apache Tomcat Cheatsheet"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/02453b5f72c0a67d5fff51eded4c800a","name":"Odysseas Mourtzoukos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/cropped-Photo-96x96-1-96x96.jpg","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/cropped-Photo-96x96-1-96x96.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/cropped-Photo-96x96-1-96x96.jpg","caption":"Odysseas Mourtzoukos"},"description":"Mourtzoukos Odysseas is studying to become a software engineer, at Harokopio University of Athens. Along with his studies, he is getting involved with different projects on gaming development and web applications. He is looking forward to sharing his knowledge and experience with the world.","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/odysseas-mourtzoukos"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/117915","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/127306"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=117915"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/117915\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/84"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=117915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=117915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=117915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}