The moose likes Servlets and the fly likes How to map apache to tomcat? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to map apache to tomcat?" Watch "How to map apache to tomcat?" New topic

How to map apache to tomcat?

Andrew Parker
Ranch Hand

Joined: Nov 12, 2001
Posts: 178
I have several users under /home/users on my redhat7.3. I want their directories can support JSP and servlet.
So far as the apache-tomcat-connetor is concerned, I cannot find the mod_jk from http://jakarta.apache.org/builds/jakarta-tomcat-connectors/ and http://www.rpmfind.net.
Now, I installed the mod_webapp.so which downloaded from rpmfind.net.
I read the doc http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/warp.html
but unable to configure the server.xml and httpd.conf files.
In mod_webapp, there is no worker.properties, how should I map apache to tomcat4?
Thanks for help
Andrew Parker
Ranch Hand

Joined: Nov 12, 2001
Posts: 178
I removed the mod_webapp.so and install mod_jk.so. But, httpd shows an error and cannot be started now.
Loaded DSO modules/mod_jk.so uses plain Apache 1.3 API, this module might crash under EAPI! (please recompile it with - DEAPI).
What does it mean and how should I do it now?
According to http://www.yolinux.com/TUTORIALS/LinuxTutorialTomcat.html#APACHETOMCAT, here were my steps (Please tell me which part I was wrong):
1. I installed mod_jk-1.3-1.0- which was downloaded from http://jakarta.apache.org/builds/jakarta-tomcat-4.0/archives/v4.0.2/rpms/
2. I downloaded http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin/linux/i386/mod_jk-3.3-ap13-eapi.so, rename it to mod_jk.so and replace the one located under /usr/lib/apache/mod_jk.so.
3. Modify: /etc/httpd/conf/workers.properties
4. Add to: /var/tomcat4/conf/server.xml
5. Add to: /etc/httpd/conf/httpd.conf
6. Modify: /etc/httpd/conf/mod_jk.conf
Thanks for any advice.
Andrew Parker
Ranch Hand

Joined: Nov 12, 2001
Posts: 178
anyone could help?
Andrew Parker
Ranch Hand

Joined: Nov 12, 2001
Posts: 178
The apache can connect to tomcat.
When I run http://localhost/examples/servlet/MyHelloWorld, it works now.
I did not setup Virtualhost. However, I have many users like localhost/~userA.
I tried to add JkMount /*.jsp ajp13, JkMount /servlet/* ajp13 to httpd.conf in-between <Directory /home/*/html> </Directory>.
However, the apache cannot be started because they cannot be added in-between <Directory>.
I also tried to add <Host name="localhost/~userA">
<Context path="" docBase"/home/userA/html" /></Host> to server.xml.
But, it still did not work.
So, how should I configure httpd.conf, worker.properties and server.xml or other files in order to make it work?
And advice?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019

You probably would have gotten more responses if you'd asked this in the Apache/Tomcat Forum.
Ypu might be able to convert the URLs from the "~" shorthand to explicit paths using mod_rewrite, but I don't guarantee it, since mod_webapp has been known to be greedy and grab stuff before other Apache modules can see it. Maybe Apache 2.0 is better equipped to handle that.
Mod_webapp was supposed to get friendlier in that regard, but if it has, it's been within the last 6 months, since that's when I last researched it.

Customer surveys are for companies who didn't pay proper attention to begin with.
Don't get me started about those stupid light bulbs.
subject: How to map apache to tomcat?