Tomcat 5 on Linux Step-By-Step

Pascal Chong

Last Updated: June 2004, Created: 12 May 2003

Table of Contents
1. Revision History
2. Introduction
2.1. Why Am I Writing This ?
2.2. Copyright, License and Other Caveats
2.3. What is Tomcat ?
2.4. Why Should I Use It ?
2.5. Tomcat Versions
2.6. Tested Platforms
3. Installing Tomcat
3.1. Prerequisites
3.2. Downloading The Software
3.3. Installing The Software
3.4. Starting and Stopping Tomcat
3.5. Running Tomcat as Non-Root User
4. Deploying Web Applications
4.1. Creating the HelloWorld Servlet
4.2. Deploying "HelloWorld"
4.2.1. Creating the directory structure
4.2.2. Creating the Context Descriptor file
4.2.3. Creating a web.xml file for the web application
4.2.4. Copying the servlets, JSPs and support files to their respective directories
4.3. Saying "HelloWorld"
4.4. Deploying Java Server Pages
5. Administering Tomcat
5.1. The Administration Tool Web Appplication
5.2. The Manager Web Application
5.3. Status Web Application
6. Customizing Tomcat
6.1. Disable Directory Listing
6.2. Custom Default Pages
6.3. Custom Error Pages
7. Tomcat Realms
7.1. Exercise Overview
7.2. JDBC Realm
7.2.1. Install and Setup the Database
7.2.2. Install the JDBC Driver
7.2.3. Setting Up The Database Tables
7.2.4. Test The JDBC Driver and Connection
7.2.5. Deploy and Test the Web Application
7.2.6. Prepare the Necessary Login and Error HTML Files
7.2.7. Edit Tomcat's server.xml To Enable JDBC Realm
7.2.8. Edit the Web Application's web.xml To Require Authentication
7.2.9. Start Tomcat and Test
8. Integrating Tomcat 5 and Apache 2
8.1. Using mod_jk2
8.1.1. Getting the mod_jk2 connector
8.1.2. Server Environment and System Requirements
8.1.3. Exercise Overview
8.1.4. Building mod_jk2
8.1.5. Edit Configuration Files httpd.conf,, and server.xml.
8.1.6. Configuring for UNIX sockets
8.1.7. Start Tomcat
8.1.8. Start Apache
8.1.9. Verify that everything works
8.2. Reverse Proxy with Apache
8.2.1. System Requirements
8.2.2. Exercise Overview
8.2.3. Edit Tomcat's server.xml
8.2.4. Edit Apache's httpd.conf
8.2.5. Testing Apache's Reverse Proxy
9. References and Useful Links
A. mod_jk2 404 Error Problem [With Help From Trevor Butler]
A.1. Problem Description
A.2. Why does this happen?
A.3. A Solution
B. About the changes in web application deployment section
C. Building mod_jk2 on Red Hat Enterprise Linux 3 (RHEL) [Contributed by Andrew Clute]
D. Eclipse Tomcat and the Tomcat Deployer [Contributed by Patricia Karsten]
D.1. About the Tomcat Deployer
D.2. Integrating the Tomcat Deployer, Eclipse and Tomcat