Lecture Notes Twenty-Four: Server-Side Java

Welcome to Lecture Notes Twenty-Four. Here are the highlights:

  1. This is your Lab 12 assignment, and provides the context for Homework Six.
  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 (32xxx and 33xxx) as described below.

The xxx stands for the last three digits in your current port.

Information about the Jakarta project can be found here. We now get started.

1. Download a latest Tomcat.

Download

 jakarta-tomcat-3.2.3.tar.gz   17-Jul-2001 10:33  2.7M  GZIP compressed file
from
http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.3/bin/
into your
/u/username/apache
directory (which is where your apache_1.3.20 directory also is).

You could also get the file from

/u/dgerman/public/jakarta-tomcat-3.2.3.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.3-src
directory gets created. Then remove the .tar file.

3. Configure Tomcat

Go to

/u/username/apache/jakarta-tomcat-3.2.3/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="32xxx"/>
</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="33xxx"/>
</Connector>
Where 32xxx and 33xxx 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="32xxx"/>
---
>                 value="8080"/>
260c260
<             <Parameter name="port" value="33xxx"/>
---
>             <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.3
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:32xxx
where 32xxx 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.

You might need to refer to this a lot later, so better index it here.


Last updated: Nov 14, 2001 by Adrian German for A348/A548