Jakarta Tomcat Servlet Engine How-To for Linux

Getting Started

Before insalling Jakarta Tomcat on your Linux box, be sure you have a JSDK installed.  You can obtain a JSDK for your version of linux from Blackdown.org or Sun Microsystems.  To install and configure Java in Linux, please follow the instructions provided here.

For the purposes of this paper, it will be assumed that you have installed a JSDK and it is located in:


And java is then located in:


If your setup is different, please adjust accordingly. 

Obtaining Tomcat

First, you need to decide how you intend to run Tomcat.  You have two options for doing this.  The first option is running Tomcat standalone, and the second is to integrate it into your existing web server.  For the purposes of this document, we will discuss running Tomcat standalone, and integrating it with Apache web server.  Tomcat will integrate with other brands of web servers, but only Apache will be discussed here.

If you are choosing to run Tomcat standalone, I recommend you download and install version 4.  However, if you plan to integrate Tomcat with Apache, I found it a lot easier to integrate version 3.  Again, for the purposes of this document, we will only discuss integrating version 3 with Apache.

Select your download:

Apache Tomcat 3.3 Apache Tomcat 4.0.1
jakarta-tomcat-3.3a.zip jakarta-tomcat-4.0.1.zip

Unzipping and Placing Tomcat

Once you've obtained Tomcat, you need to unzip and place it.  Use the following command to unzip your package:

/usr/java/j2sdk1.4.0/bin/jar xf jakarta-tomcat-x.x.zip

Where x.x is the version of Tomcat you have chosen to download.  Once unzipped, you should have a directory named 'jakarta-tomcat-x.x'.  Now, move that directory and its contents to /var/jakarta:

mv jakarta-tomcat-x.x /var/jakarta

Configuring Jakarta

Now, go into /var/jakarta/bin/ and chmod a+x *.sh.  Now, while still in that directory, you are going to have to do a hack on the tomcat.sh (version 3) or catalina.sh (version 4) depending on which version you are installing.  This is technically not how it is supposed to be done, but this saves a lot of time, and takes away a lot of the guesswork.  Add the following to the beginning of  the .sh file based on your version (the line following the #!/bin/sh):

export JAVA_HOME=/usr/java/j2sdk1.4.0
export TOMCAT_HOME=/var/jakarta   # (Version 3)
export CATALINA_HOME=/var/jakarta # (Version 4)

Basically, by adding these two lines, you are short circuiting the config mechanism used by Jakarta to find the Home of Java and Tomcat.  This is much easier than hunting down all of the config files and changing them individually.

Setting Jakarta to Start at Boot

This section will be completed at a later date.  For the time being, jakarta can be started manually with the following command:

/var/jakarta/bin/tomcat.sh start

for version 3, or:

/var/jakarta/bin/catalina.sh start

for version 4.

Using Jakarta

By default, in standalone mode, Jakarta runs on port 8080.  Servlets must be deployed in the /var/jakarta/webapps/ROOT/WEB-INF/classes/ directory.  Servlets deployed in this directory may be viewed using the URL of the form http://myhost:8080/servlet/MyServlet where MyServlet is the name of the servlet being deployed.

JSP will be discussed at a later date.

Integrating Jakarta with Apache

To integrate Jakarta with Apache, we'll assume you have followed the above instructions to set up Jakarta, and you have installed version 3.

First, you need to obtain and install mod_jk.so.  You should select the correct version of mod_jk.so based on your configuration of Apache:

Apache 1.3 with extended API: mod_jk-3.3-ap13-eapi.so
Apache 1.3 without extended API: mod_jk-3.3-ap13-noeapi.so
Apache 2.0 mod_jk-3.3-ap20.so

Once you've downloaded the correct file, rename it to mod_jk.so and place it in /usr/lib/apache/.  Be sure to chmod a+x mod_jk.so after you've copied it to /usr/lib/apache/.

Now, you need to edit your /var/jakarta/conf/jk/mod_jk.conf file.  Replace:

LoadModule jk_module modules/mod_jk.dll


LoadModule jk_module modules/mod_jk.so

and replace:

JkWorkersFile <fill-path-to>/workers.properties


JkWorkersFile /var/jakarta/conf/jk/workers.properties

At this point, everything is configured on the Jakarta side of things.  All that is left, is to configure Apache.  Add the following line to the end of /etc/httpd/conf/httpd.conf:

Include /var/jakarta/conf/jk/mod_jk.conf

Now, Apache has been configured and Jakarta has been configured.  Make sure Jakarta is running (See "Using Jakarta" above), and restart apache:

/usr/sbin/apachectl restart

Assuming Apache restarts without error, your servlets can now be accessed using the following URL:


where MyServlet is the servlet being deployed.  Even though Jakarta is now integrated into Apache, you still deploy your servlets in:


Congratulations!  You have installed Jakarta.

Copyright 2002-2017 Wade Wassenberg
Last Modified: June 30, 2003. 
If you have questions, comments, or if you find any part of this document to be inaccurate or incorrect, please submit your feedback to webmaster@wass.homelinux.net.