Configuring & Using Apache Tomcat

A Tutorial on Installing and Using
Jakarta Tomcat 5.5 for Servlet and JSP Development

Following is a guide to installing and configuring Apache Tomcat 5.5 for use as a standalone Web server (for development) that supports servlets 2.4 and JSP 2.0. (Note: Apache Tomcat is sometimes referred to as "Jakarta Tomcat" since the Apache Java effort is known as "The Jakarta Project"). This Tomcat tutorial covers version 5.5.17, but the steps are almost the same for any Tomcat 5.5.x version. For coverage of Tomcat 6, see the separate Tomcat 6 tutorial. For coverage of older Tomcat versions (Apache Tomcat 5.0.x and Apache Tomcat 4.0.x), please see the Apache Tomcat 5.0 and 4.0 tutorial.

Using Tomcat as a deployment server or integrating Tomcat as a plugin within the regular Apache server or a commercial Web server is more complicated than what is described in this tutorial. Although such integration is valuable for a deployment scenario (see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/), my goal here is to show how to use Tomcat as a development server on your desktop. Regardless of what deployment server you use, you'll want a standalone server on your desktop to use for development.

The examples here assume you are using Windows, but they can be easily adapted for MacOS, Linux, Solaris, and other versions of Unix. Except when I refer to specific Windows paths (e.g., C:\blah\blah), I use URL-style forward slashes for path separators (e.g., install_dir/webapps/ROOT). Adapt as necessary.

The information here is adapted from the introductory setup and configuration chapter of Core Servlets and JavaServer Pages, 2nd Edition, Volume 1 from Sun Microsystems Press and Prentice Hall. For the book table of contents, index, source code, etc., please see http://volume1.coreservlets.com/. For information on training courses (either at public venues or on-site at your company) taught by the author of the book and this Apache Tomcat tutorial, please see the servlet, JSP, Struts, JSF, AJAX, and Java 5 training courses page. To report errors or omissions in this writeup or to inquire about on-site training courses on servlets, JSP, Struts, JSF, AJAX, Java 5, and other J2EE technologies, please contact Marty Hall at [email protected].


Executive Summary

Most people will just want to download the preconfigured Tomcat version, set JAVA_HOME and CLASSPATH, and they are done. But following is a summary of the steps for people who want to change the configuration or do it themselves. This section gives a summary of the required steps; I give extremely detailed instructions in the following sections.