CSCI A348/548
Lab Notes Five

Spring 2001 (Second semester 2000-2001)


Server-side Java. Java servlets and Java Server Pages (JSP). Part I: Installing Tomcat.
Welcome to Lab Five. Here are the highlights:
  1. This is your third assignment, and provides the context for the fourth one.
  2. You will be installing a precompiled version of Tomcat.
  3. This will give you server-side Java support: servlets and JSP.
  4. The installation is fairly short, but please proceed with care.
  5. You will be using two new ports (21xxx and 22xxx) as described below. The xxx stands for the last three digits in your current port.
1. Download the latest Tomcat.

Download

jakarta-tomcat-3.2.1.tar.gz   12-Dec-2000 14:29   2.7M  GZIP compressed file
from
http://jakarta.apache.org
into your
/u/username/apache
directory (which is where your apache_1.3.14 directory also is).

You could also get the file from

/u/dgerman/public/jakarta-tomcat-3.2.1.tar.gz
2. Uncompress and unpack the archive

Run

gunzip *.gz
in the directory, then
tar xvf *.tar
and check that a jakarta-tomcat-3.2.1 directory gets created.

Then remove the .tar file.

3. Configure Tomcat

Go to

/u/username/apache/jakarta-tomcat-3.2.1/conf
and make a backup copy of server.xml (mine is called server.xml.backup).

Then make the following changes.

<!-- Normal HTTP -->
<Connector className="org.apache.tomcat.service.PoolTcpConnector">
    <Parameter name="handler" 
        value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
    <Parameter name="port" 
        value="21xxx"/>
</Connector>

<!-- Apache AJP12 support. This is also used to shut down tomcat.
  -->
<Connector className="org.apache.tomcat.service.PoolTcpConnector">
    <Parameter name="handler" 
        value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
    <Parameter name="port" value="22xxx"/>
</Connector>
Where 21xxx and 22xxx are your own ports and they replace the defalut values (8080 and 8007).

burrowww.cs.indiana.edu% diff server.xml server.xml.backup
225c225
<                 value="21006"/>
---
>                 value="8080"/>
260c260
<             <Parameter name="port" value="22006"/>
---
>             <Parameter name="port" value="8007"/>
burrowww.cs.indiana.edu%
4. Prepare the environment

Add the following three lines at the end of your ~/.cshrc file:

setenv JAVA_HOME   /l/jdk1.2
setenv TOMCAT_HOME /u/username/apache/jakarta-tomcat-3.2.1
setenv CLASSPATH   .:$TOMCAT_HOME/lib/servlet.jar
setenv myServlets  $TOMCAT_HOME/webapps/examples/WEB-INF/classes
Save the file, log out and log back in (or use source on it).

5. Start Tomcat

Go to $TOMCAT_HOME then type bin/startup.sh at the prompt, press Enter.

6. Run servlets, demo JSPs

In Netscape go to:

http://burrowww.cs.indiana.edu:21xxx
where 21xxx is your own port.

Try some of the servlets and JSPs listed on the page. (Here's my installation.)

Your installation is complete if all the examples run.

7. Stopping Tomcat

Go to $TOMCAT_HOME then type bin/shutdown.sh at the prompt, press Enter.


Last updated on Feb 6, 2001, by Adrian German for A348/A548