Andrew Channels Dexter Pinion

Wherein I write some stuff that you may like to read. Or not, its up to you really.

December 15, 2003

Tomcat 5.0 and Apache 2.0

Ah, the joys of open source software. For various reasons I'm trying to connect Apache Tomcat 5.0 to serve through Apache 2.0.

What is scuppering me is the usual open source problem that the documentation isn't keeping up with the software. Delving into the Tomcat 5 documentation is frustrating, because as soon as you click on any link relating to Apache integration (for instance the section on JK2) you are taken to the 4.0 documentation. So far, the only thing I have been able to discover with any confidence is that the intstructions for linking Tomcat 4.0 and Apache 2.0 don't work with Tomcat 5.0. But then I could have guessed that.

Anyone got any suggestions? Or should I just run Tomcat 4.1?

Posted by Andy Todd at December 15, 2003 01:18 PM


I would have to take you out for a pint if you were in australia. You couldnt be more right, tomcat 5 and jk2-2.0.43.dll (latest build) are hard to configure with no documentation WHAT SO EVER. I think the 'tomcat user group' is a good place to start. I have got answers on there concerning this before. There are some links for doing tomcat 4 but thats about it. If i get mine working I will post it on the java dev site overtop of the tomcat 4 one. Can you do the same?

cheers mate!

Posted by: Brennon on January 21, 2004 01:57 AM

I have exactly your same idea, are 2 days that I am looking documentation visiting web sites but It is very confused. No clear information how to integrate Apache 2.0 and Tomcat 5.0. I am considering to buy some commercial products at this point.

Posted by: Nazzareno on January 22, 2004 09:11 AM

I reckon I've got the connectors issue sorted.

Download the 5.0.18 binaries, and install them as normal.

The get the source. I got it from here:

gunzip it, untar it, then cd to the jakarta-tomcat-5.0.18-src/jakarta-tomcat-connectors/jk/native directory.

Run, then run:

./configure -with-apxs=/usr/local/apache2/bin/apxs

(or wherever your apache2 apxs is, obviously. Then you end up with a shiny new

Check the BUILDING file in the jakarta-tomcat-5.0.18-src/jakarta-tomcat-connectors/jk/native directory.

I haven't tested it yet, so caveat emptor...

Posted by: Mark Henshall on February 4, 2004 12:24 PM

Ask, and the blogosphere will provide. Diego Doval posted this tutorial on connecting Apache 2, Tomcat 5 and MySQL today;

Blimey, PHP isn't that hard.

Posted by: Andy Todd on February 11, 2004 11:12 AM

You also might find it easier to use mod_proxy to get requests to Tomcat5 via Apache2. I've managed to get it working.

Posted by: Zach on March 12, 2004 02:37 PM

Hi I'm also trying to integrate Tomcat5 and Apache2. Its really bloody annoying. I downloaded a bundle package called Xampp which sets up a Apache server with PHP/MySQL/PEAR/CGI/PERL and am now trying to integrate it with my fully configured Tomcat5 container.

God what a pain in the ass! I've suggested to the makes of Xampp that they integrate JSP/Tomcat into their setup. But we'll have to wait for that. Also I have read that Tomcats connectors have been removed from their web site. I've also noticed that I've download a file for WinXP is this right? I thought it was suppose to be a *.dll file?

Regards - Fan

Posted by: Fan on April 25, 2004 06:56 PM

How to build a module for Apache2.0.49 and Tomcat5.0.19 on linux
Redhat 8.0
Apache is installed at: /usr/local/apache2.0.49
Login: root
# Script to Build

## 1. Install Apache2.0
## 2. Download and unzip tomcat5 source distribution.
## 3. Set the {apache_home} and {tomcat_source} environment variables.



cd ${tomcat_source}/jakarta-tomcat-connectors/jk/native2
chmod +x
./configure --with-apxs2=${apache_home}/bin/apxs

echo "Show location of"
find . -name "mod*jk*.so"

#libtool --finish ${apache_home}/modules

## Uncomment the following lines to install jk2 in your apache modules directory.
#echo Installing in ${apache_home}/modules
#cp ${tomcat_source}/jakarta-tomcat-connectors/jk/build/jk2/apache2/ ${apache_home}/modules
#cd ${apache_home}/modules
#chmod +x

cd ${start_dir}

Posted by: Dan Riesland on April 30, 2004 12:11 AM

I finally got Tomcat 5 to work with Apache 2 on Win XP.
I will just post the basics of the config.
I will not go through the installation of Apache or Tomcat.

1. Download mod_jk2 and put it in [apache_HOME]/modules and rename it

2. Edit [apache_HOME]/conf/httpd.conf file and add:

LoadModule jk2_module modules/

to the LoadModules section.

3. Create in the [apache_HOME]/conf folder and add:

# socket channel
# worker for the connector

Edit the paths to reflect your installation

4. Edit [tomcat_HOME]/conf/ and add:


5. OPen [tomcat_HOME]/conf/server.xml and add:

< Context path="" docBase="c:/[apache_HOME]/htdocs" debug="0" reloadable="true" crossContext="true"/>

6. Stop both Tomcat and Apache

7. Restart Tomcat and test Tomcat by going to http://localhost:8080/jsp-examples
If this works:

8. Start apache and go to http://localhost/jsp-examples
If this works, GREAT, you've got it.
If it doesn't? Good luck. The documentation for this implementation sux.
You can check these to url. I used both:

Posted by: Greet Rufus on May 23, 2004 03:47 PM

I am very happy with your contribution... It really helped me a lot. I was struggling for last 72 hours, but within no time it started working

Posted by: Sanjay on July 7, 2004 08:01 AM

your guideline really helps, thank youuuuuuuuuuuu!!!!!

Posted by: jwangk on July 22, 2004 12:37 PM

Thank you very much for this guideline...
it works for Tomcat 3.* and 4, too.

Posted by: LevinBeicht on August 30, 2004 01:41 PM

Hi David (Greet Rufus)....its fine...So thankfull to U on this....Thank U (1 mil)..

Posted by: Raj on October 29, 2004 02:14 PM

exactly where do you post the statment in step 5? I've tried everywhere in the server.xml file, and can't seem to get it to work.


Posted by: almeister on November 9, 2004 11:56 AM