NOTE
Apache Tomcat is NOT the same as Apache JServ. I have received confused messages from people trying to install both at the same time or use the instruction below for JServ. You can not do that.
NOTE 2
These instructions are for Tomcat v3.x. Things has changed, sometime very much so with Tomcat v4.x. I am in the process of updating this guide but it is not finish yet. It's actually easier to install and config Tomcat 4.x (IMHO).
ASSUMPTIONS: 1. Files are installed in C:\Program Files\Apache Group\[application] -Apache Group will be referred to as "root" (root of all Apache software) -Application = Apache, Jakarta/Tomcat NOTE: Some of the files used to build your "myapp" application (discussed below) are bad even in the Tomcat 3.1 release. Go to the Web CVS to get newer versions of those files if need be. You can find those updated files here: http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/ The ones I found necessary to update are: - http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/src/doc/uguide/tomcat_ug.html - http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/src/doc/NT-Service-howto.html - http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/src/doc/in-process-howto.html - http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/src/doc/appdev/build.xml.txt - http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/src/doc/appdev/sample/build.bat - http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/src/doc/appdev/sample/build.xml The files above are all files that map to your root/Jakarta/Tomcat/doc directory. BASICS: 1. Get JDK http://java.sun.com/j2se/1.3/ (recommend JDK 1.3 or newer) 2. Install JDK 3. Get Apache Web Server http://www.apache.org/dist/binaries/win32/ 4. Install Apache Web Server 5. Get Apache Tomcat http://jakarta.apache.org/builds/tomcat/release/v3.1/bin/ a. Use Winzip to unzip jakarta-tomcat.zip to root b. Rename jakarta-tomcat folder to "Jakarta" 6. Get ApacheModuleJServ.dll.zip http://jakarta.apache.org/builds/tomcat/release/v3.1/bin/win32/i386/ 7. Extract ApacheModuleJServ.dll to root/apache/modules 8. Add new Environment Variables: a. JAVA_HOME = C:\jdk1.3 b. TOMCAT_HOME = C:\Program Files\Apache Group\Jakarta\Tomcat 9. Add to BEGINNING of PATH variable: %JAVA_HOME%\bin; (makes sure to use JDK java.exe rather than Microsofts) 10. Add to BEGINNING of CLASSPATH variable: C:\Progra~1\Apache~1\Jakarta\Tomcat\lib\servlet.jar; (for servlet compilation) EDIT FILES: 1. root/Jakarta/Tomcat/conf/tomcat.conf Make your tomcat.conf look like this: ############################################################################### # Apache JServ Configuration File # ############################################################################### # Note: this file should be appended or included into your httpd.conf # Tell Apache on win32 to load the Apache JServ communication module LoadModule jserv_module modules/ApacheModuleJServ.dll # Tell Apache on Unix to load the Apache JServ communication module # For shared object builds only!!! # @LOAD_OR_NOT@LoadModule jserv_module @LIBEXECDIR@/mod_jserv.so #LoadModule jserv_module libexec/mod_jserv.so# Do not edit! ApJServManual on ApJServDefaultProtocol ajpv12 ApJServSecretKey DISABLED ApJServMountCopy on ApJServLogLevel notice ### Change if you run tomcat on a different host ApJServDefaultHost localhost ApJServDefaultPort 8007 #################### All jsp files will go to tomcat #################### ApJServMount default /root AddType text/jsp .jsp AddHandler jserv-servlet .jsp ############################## Context mapping - all requests go to tomcat ApJServMount /examples /root ############################## Context mapping - you need to "deploy" # ( copy or ln -s ) the context into htdocs ## # ApJservMount /CONTEXT/servlet /root # 2. root/apache/conf/httpd.conf add the following to the bottom of your httpd.conf: # Include the configuration for Apache Jakarta Tomcat 3.1 Include "C:\Program Files\Apache Group\Jakarta\Tomcat\conf\tomcat.conf" RUNNING SERVLETS: 1. Stop Apache Web Server if it is running 2. open a command prompt and browse to root/Jakarta/Tomcat/bin 3. Type "tomcat" to get a list of option for the tomcat.bat file a. type "tomcat start" to open tomcat in a new window b. type "tomcat stop" to stop tomcat if you used the "start" command for startup c. type "tomcat run" to run tomcat in current window d. hit ctrl+c and then "Y" (when prompted) to stop tomcat if you used the "run" command for startup 4. Once you have Tomcat started, start up Apache Web Server NOTE: Apache loads the root\Jakarta\Tomcat\conf\tomcat-apache.conf at startup, so if you ever change anything with Tomcat, run through these steps again 5. To run the examples, go to http://localhost/examples/ a. from here you can look at the servlets folder or the jsp folder b. click on the servlet/jsp you want to view NOTE: Tomcat, by default, will map your URL to "/examples/servlet/[theservlet] -notice the singular "servlet" rather than the plural "servlets" when you are just viewing the HTML servlet chooser file -this can be overridden in Tomcat, but that is not important here Example: you have helloworld servlet in examples, URL is http://localhost/examples/servlet/helloworld CREATING YOUR OWN SERVLET APPLICATION: 1. Look in the root/Jakarta/Tomcat/doc/appdev/sample directory 2. Move this directory structure and the files to a place on your drive where you want to do development of servlets 3. Add a directory called "lib" (they forgot to include it) 3. Compile the Hello.java in the "src" directory 4. run "build" -this will create a new directory under "root/Jakarta/Tomcat/webapps/" called "myapp" 5. Look at the directory stucture in the "myapp" directory -Your class file will be in the "WEB-INF/classes" directory 6. go to the root/Jakarta/Tomcat/conf directory and open tomcat.conf and server.xml a. in tomcat.conf, add "ApJServMount /myapp /root" where you see the same done with "ApJServMount /examples /root" b. in server.xm., add# AllowOverride None # deny from all # near the bottom of the file (you will see where) 7. Go through the "RUNNING SERVLETS" steps again 8. Go to http://localhost/myapp/ to see the home page for your "myapp" application RUNNING TOMCAT AS AN NT SERVICE: 1. Just follow instructions in the "root\Jakarta\Tomcat\doc\NT-Service-howto.html"
Last Updated: $Date: 2002/02/08 01:38:03 $