Tomcat Java servlet engine
Versions
Tested with Tomcat 4.1.30, Kaffe 1.1.4, mod_jk2 2.0.4, apr 0.9.4 and apr-util 0.9.4.
Overview
This document covers the installation of:
- Kaffe, a Java Virtual Machine released under the GPL.
- Tomcat, a daemon for running web applications written in Java.
- mod_jk2, an Apache module that allows the Apache HTTP server to delegate requests to Tomcat.
Installation
Download the latest development version of Kaffe.
tar zxf kaffe-1.1.4.tar.gz
cd kaffe-1.1.4
./configure --prefix=/usr/local/kaffe
make
sudo make install
Download the latest version of Tomcat 4 (Tomcat 5 won't work with Kaffe), and patch its configuration files with
server.xml.patch and
web.xml.patch.
tar zxf jakarta-tomcat-4.1.30.tar.gz
cd jakarta-tomcat-4.1.30
patch -p0 < ../server.xml.patch
patch -p0 < ../web.xml.patch
cd ..
sudo mv jakarta-tomcat-4.1.30 /usr/local/tomcat4
Install
/etc/init.d/tomcat4. Make it executable and make symlinks for it:
sudo chmod a+x /etc/init.d/tomcat4
sudo update-rc.d tomcat4 defaults
See if it works:
sudo /etc/init.d/tomcat4 start
Give about 30 seconds to start up, then see if you get a nice welcome page when you visit
http://myserver:8080.
If that's OK, you're ready to install the Apache mod_jk2 connector. Download the latest versions of:
tar zxf apr-0.9.4.tar.gz
tar zxf apr-util-0.9.4.tar.gz
tar zxf jakarta-tomcat-connectors-jk2-src-current.tar.gz
BASE_PATH=`pwd`
cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2
CC=cc ./configure --with-apxs=/usr/local/apache/bin/apxs --with-apr=$BASE_PATH/apr-0.9.4 --with-apr-util=$BASE_PATH/apr-util-0.9.4 --disable-apr-threads
make
cd ../build/jk2/apache13
sudo /usr/local/apache/bin/apxs -n jk2 -i mod_jk2.so
sudo touch /usr/local/tomcat4/conf/jk2.properties
Install
/usr/local/apache/conf/workers2.properties. Change
example to the name of your web application.
Edit
/usr/local/apache/conf/httpd.conf, adding the following to the Dynamic Shared Object section:
LoadModule jk2_module libexec/mod_jk2.so
Now drop your web application (a
.war file) in
/usr/local/tomcat4/webapps. Restart Tomcat and Apache:
sudo /etc/init.d/tomcat4 restart
sudo /etc/init.d/apache restart
If your webapp was
example.war, you should now be able to use it by visiting
http://myserver/example in a browser.
You can now set up an Apache virtual host for your webapp. You'll want to include something like this in it, to make the base URL refer to your webapp:
<IfModule mod_alias.c>
RedirectMatch ^/$ http://example.info/example/
</IfModule>