View Single Post
Old 06-02-2009, 02:05 PM
bholus7 bholus7 is offline
Join Date: Apr 2009
Posts: 1,322
Default Configuring & Using Apache Tomcat

Configuring & Using Apache Tomcat

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.

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.

* Install the JDK. Make sure JDK 1.5 or 1.4 is installed and your PATH is set so that both "java -version" and "javac -help" give a result.
* Configure Tomcat.

1. Download the software. Go to and download and unpack the zip file for the current release build of Tomcat 5.5. Using Tomcat with JDK 1.5 (Java 5) is preferred, but if you use JDK 1.4, you have to also download and unpack the "Compat" zip file.

The the preconfigured Tomcat version already contains the "Compat" files and can be used with either Java 5 (1.5) or Java 1.4.

2. Set the JAVA_HOME variable. Set it to refer to the base JDK directory, not the bin subdirectory.

3. Change the port to 80. Edit install_dir/conf/server.xml and change the port attribute of the Connector element from 8080 to 80.

4. Turn on servlet reloading. Edit install_dir/conf/context.xml and change to .

5. Enable the invoker servlet. Go to install_dir/conf/web.xml and uncomment the servlet and servlet-mapping elements that map the invoker servlet to /servlet/*.

6. Change the DOS memory settings. If you are on Windows 98/Me and get an "Out of Environment Space" error message when you start the server, right-click on install_dir/bin/startup.bat, select Properties, select Memory, and change the Initial Environment entry from Auto to at least 2816. Repeat the process for install_dir/bin/shutdown.bat. Only needed for Windows 98 and ME; not necessary on recent versions of Windows.

7. Set the CATALINA_HOME variable. Optionally, set CATALINA_HOME to refer to the top-level Tomcat installation directory. Not necessary unless you copy the startup scripts instead of making shortcuts to them.

8. Use a preconfigured Tomcat version. Optionally, use a version of Jakarta Tomcat that has all of the above changes already made, and has the test HTML, JSP, and servlet files already bundled. Just unzip the file, set your JAVA_HOME and CLASSPATH variables, and you are ready to go.

Reply With Quote