Online Shopping

+ Search
Add Entry AlertManage Folder Edit Entry Add page to
Did You Find This Entry Useful?

30 of 48 people (63%) answered Yes
Recently 7 of 10 people (70%) answered Yes


How do you configure Apache to run with Tomcat 4.0?

Mar 31st, 2009 10:26
engatoo engatoo, seo webmaster, osama said, i can do it, Dave Goose, Tim Cooke, Raymond Monroe, Dave Goose

A. Install the JDK. Make sure you have JDK 1.3 or 1.4 installed and 
PATH set so that both 
   "java -version" and "javac -help" give a result. 
B. Configure Tomcat: 
1. Download the software: 
   Go to
and download and unpack the zip file for the 
   latest version (4.1.24 as of last revision of this page). 
2. Enable the ROOT context. Edit install_dir/conf/server.xml and
uncomment this line: <Context path="" 
   docBase="ROOT" debug="0"/>. Not necessary in Tomcat 4.0.3 and
earlier. In Tomcat 5.0.3, the element is missing the 
   trailing slash and you need to add it. 
3. Enable the invoker servlet. Go to install_dir/conf/web.xml and
uncomment the servlet-mapping element that maps the 
   invoker servlet to /servlet/*. Not necessary prior to Tomcat 
4. Change the port to 80. Edit install_dir/conf/server.xml and change
the port attribute of the Connector element 
   from 8080 to 80. 
5. Turn on servlet reloading. Edit install_dir/conf/server.xml and add 
DefaultContext subelement to the main 
   Service element and supply true for the reloadable attribute. 
6. Set the JAVA_HOME variable. Set it to refer to the base JDK
directory, not the bin subdirectory. 
7. Change the DOS memory settings. If you get an "Out of Environment
Space" error message when you start the server, 
   right-click on install_dir/bin/startup.bat, select Properties, 
Memory, and change the Initial Environment 
   entry from Auto to at least 2816. Repeat the process for
8. Set the CATALINA_HOME variable. Optionally, set CATALINA_HOME to
refer to the top-level Tomcat installation directory. 
C. Test the server:
1.Verify that you can start the server. Double-click
install_dir/bin/startup.bat and try accessing http://localhost/. 
2. Check that you can access your own HTML & JSP pages. Drop some 
HTML and JSP pages into 
   install_dir/webapps/ROOT and access them with 
D. Set up your development environment:
1. Create a development directory. Put it anywhere except within the
Tomcat installation hierarchy. 
2. Make shortcuts to the Tomcat startup & shutdown Scripts. Put
shortcuts to install_dir/bin/startup.bat and 
   install_dir/bin/shutdown.bat in your development directory and/or on
your desktop. 
3. Set your CLASSPATH. Include the current directory ("."),
install_dir/common/lib/servlet.jar, and the 
   main development directory. 
4. Bookmark the servlet & JSP javadocs. Add
install_dir/webapps/tomcat-docs/servletapi/index.html to your 
   bookmarks/favorites list. 
E. Compile and test some simple servlets:
1. Test a packageless servlet. Compile a simple servlet, put the .class
file in install_dir/webapps/ROOT/WEB-INF/classes, 
   and access it with http://localhost/servlet/ServletName. 
2. Test a servlet that uses packages. Compile the servlet, put the
.class file in install_dir/webapps/ROOT/WEB-INF
   /classes/packageName, and access it with
3. Test a servlet that uses packages and utility classes. Follow the
same procedure as the second step above. 
   This third step verifies that the CLASSPATH includes the top level 
your development directory. 
F. Establish a simplified deployment method:
1. Copy to a shortcut. Make a shortcut to install_dir/webapps/ROOT. 
packageless .class files directly there. 
   With packages, copy the entire directory there. 
2. Use the -d option of javac. Use -d to tell Java where the deployment
directory is. 
3. Let your IDE take care of deployment. Tell your IDE where the
deployment directory is and let it copy the 
   necessary files. 
4. Use ant or a similar tool. Use the Apache make-like tool to automate
copying of files.