Connecting Apache 1.3 to Tomcat 3.3a

(Using JServ Web Server Connector)

tomcat.conf file

When Tomcat starts up it will automatically generate a configuration file for Apache in $TOMCAT_HOME/conf/jserv/tomcat.conf. Since we needed to change the ajp12 port from 8007 to 8027, this file should only be used as a base. If you change this file, it will get overwritten every time Tomcat starts.

Simply copy this file to a different filename (i.e. tomcat_dbaprod.conf).

Now edit the tomcat_dbaprod.conf file and make the following changes:

Add the following:
ApJServProperties /u02/app/tomcat/conf/jserv/tomcat_dbaprod.properties
Change the following port from 8007:
ApJServDefaultPort 8027
Add the following:
httpd.conf AddModule mod_jserv.c

httpd.conf file

Now edit the httpd.conf file from Apache to “include” the tomcat_dbaprod.conf file.


include "/u02/app/tomcat/conf/jserv/tomcat_dbaprod.conf"

Obtaining the Jserv module (mod_jserv)

We now need a web server adapter to sit in Apache and redirect requests to Tomcat. For Apache, this adapter is a slightly modified version of mod_jserv. Although you may be able to find a pre-built version of mod_jserv, the DBA Group will build a fresh version from the Tomcat source code.

Building mod_jserv on UNIX involves the following:

1.  Download the source distribution of Tomcat from MetaView: dbaprod:/u01/app/oracle/web/data/Software/Tomcat/3.3a. The file is: jakarta-tomcat-3.3a-src.tar.gz.

2.  Uncompress / untar it into a temporary directory

NOTE: On Solaris you will need to use the gnu version of tar. On dbaprod.comanage.net, I made a version of gnu tar called:

/usr/local/bin/gnu-tar.

3.  Building the module:

o  Change directory into jakarta-tomcat/src/native/jserv

o  If your version of Perl is not in /bin/perl, you will need to edit the apxs script to include the correct path to your perl binary.

o  Execute the build command

/u02/app/apache/bin/apxs -c -o mod_jserv.so *.c

apxs is part of the Apache distribution and should be located in your APACHE_HOME/bin.

Copy mod_jserv module to Apache

From the directory you compiled the mod_jserv.so library (above), simply copy the library module to the libexec directory of Apache:

% copy mod_jserv.so to /u02/app/apache/libexec

Once you copy the library module to the Apache libexec directory, you can remove the temporary Tomcat source code directory tree.

Test the Apache / Tomcat Configuration

First: startup Tomcat:

% $TOMCAT_HOME/bin/startup.sh

Second: startup Apache:

% $APACHE_HOME/bin/apachectl start

Testing:

Point your browser to the index page for the Apache server and verify that you get the default Apache page (unless you replaced it already with your own, of course).

Point your browser to the index page for the Tomcat server and verify that you get the default Tomcat page (unless you replaced it already with your own, of course).

Now point your browser to a URL like the following:

http://dbaprod.comanage.net/examples/servlet/HelloWorldExample

If everything works right, this request will be forwarded to Tomcat for processing and you should see the results.

Problems:

If the step above does not work, point directly to Tomcat (by changing the port in the URL) and try again. If you still have problems, then Tomcat is not processing the servlet file correctly and you need to go back through $TOMCAT_HOME/conf/server.xml and see why. You might also need to verify that the startup script, $TOMCAT_HOME/bin/tomcat.sh, is picking up the tools.jar JDK library.