Setting up Tomcat to serve Kawa servlets

Tomcat

Tomcat, is a Free web server (a so-called servlet engine). It is written in Java and released by the Apache Foundation's Jakarta project.

Download Tomcat

If necessary download Tomcat from here. At the time of writing, the latest stable release is version 5.5.12 and so you might want to get apache-tomcat-5.5.12.tar.gz.

The above distribution assumes Java 5. To run Tomcat using an older Java implemenation (such as JDK 1.4.x) you will also need apache-tomcat-5.5.12-compat.tar.gz.

Installing Tomcat

(These instructions are for a Unix-like system, such as GNU/Linux.)

Pick a suitable directory, which in the following will be referred to as $tomcat_prefix. Extract the file there:
cd $tomcat_prefix
tar xzf apache-tomcat-5.5.12.tar.gz
If you not using Java 5 (e.g. JDK 1.4.x or older), also do:
tar xzf apache-tomcat-5.5.12-compat.tar.gz

This creates the directory $tomcat_prefix/apache-tomcat-5.5.12.tar.gz. Set the environment variable $CATALINA_HOME to this directory:

export CATALINA_HOME=$tomcat_prefix/apache-tomcat-5.5.12.tar.gz

Tomcat on Fedora Core 4

The Fedora Core 4 distribution of GNU/Linux includes packages for Tomcat compiled with GCJ.

If you haven't installed the Tomcat5 packages, as root do:

# yum install tomcat5

Make sure that /usr/bin/java and /usr/bin/javac refer to the gcj versions, rather than (say) Sun's JDK:

# /usr/sbin/alternatives --config java
# /usr/sbin/alternatives --config javac
The selection should look like /usr/lib/jvm/jre-1.4.2-gcj/bin/java and /usr/lib/jvm/java-1.4.2-gcj/bin/javac, respectively.

To start Tomcat do:

# /sbin/service tomcat5 start
To shut down Tomcat do:
# /sbin/service tomcat5 stop

To have Tomcat automaticaly start on system boot, do:

# /sbin/chkconfig tomcat5 on

To set $CATALINA_HOME, as used in the following, do:

# export CATALINA_HOME=/usr/share/tomcat5

Installing Kawa/Qexo for Tomcat

You will need to install a jar file of Kawa. You can get kawa-1.8.jar (or later) the Kawa ftp site or from a mirror site. Copy this to $CATALINA_HOME/shared/lib/kawa-1.8.jar. (If you're using Tomcat 4.0.x, shared/lib doesn't exist. Install as $CATALINA_HOME/lib/kawa-1.8.jar instead.)

Starting Tomcat

If Tomcat isn't already running, start it. For example, under Unix-like systems you can run the script $CATALINA_HOME/bin/startup.sh. You may need to set the environment variable JAVA_HOME to point to where Java is installed on your machine. (On Mac OS X 10.2 this is /Library/Java/Home.) If you haven't changed any of the defaults, you should now be able to point your browser at http://localhost:8080/, and get the default Tomcat home page.

Installing Kawa servlets

For example how to use Kawa to write and install servlets, see these: