wood burning stoves*
The moose likes Tomcat and the fly likes Got Tomcat/Apache merged, but... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Got Tomcat/Apache merged, but..." Watch "Got Tomcat/Apache merged, but..." New topic
Author

Got Tomcat/Apache merged, but...

Joe Tseng
Greenhorn

Joined: Nov 09, 2004
Posts: 23
After a bit of hacking around I finally got Tomcat to play nice with Apache2 on SuSE 9.2; now I can't seem to get Apache to read the default home directory files. When I run localhost/index.jsp, it brings up the file located in $TOMCAT_HOME/webapps/ROOT rather than /srv/www/htdocs. I thought maybe I had configured Tomcat incorrectly somehow and it was running on port 80; when I stopped Apache I was immediately unable to bring up index.jsp. The reverse occured when I restarted Apache.

Any ideas?

Setup:
SuSE 9.2
Sun JDK 1.5.0_02
Tomcat 5.5.7
mod_jk 1.2.10
Apache 2.0.50
[ April 06, 2005: Message edited by: Joe Tseng ]
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
I am no expert by any means on the Apache/Tomcat marriage. But I will try to explain it the best way I can.

Of course you know that the purpose of the mod_jk connector is to route JSP/Servlet requests thru Apache to Tomcat. Which pretty much makes Apache invisible to the user as far as JSP/Servlet requests are concerned.

The "rules" of deploying applications on TOMCAT still apply. All WAR files are to be deployed in the $CATALINA_HOME/webapps directory. Of course I believe it is possible to modify the server.xml to point to another default directory but that could cause you more headaches.

The rules of deploying applications for Apache still apply. If you place an non JSP page i.e. index.html in Apache's DocumentRoot directory, Apache will service the request. If you do place a JSP page in an Apache DocumentRoot directory, apache will try to service the request. Which I believe it will either display the JSP verbatium or some error message.

For example I have a similar setup as yours
RH9
Apache
Tomcat
mod_jk2
etc.

Another example, I have just one website www.mywebsite.com. Where mywebsite.com is the name of the DocumentRoot directory. And in that directory ,I have one file (index.html) which contains one line, something similar to:


Which will route the user to the JSP index page. The url pattern "/mycontext/*" is configured in the httpd.conf or the workers2.properties.

I hope this helps.
Rahul Singh Khokhar
Ranch Hand

Joined: Feb 23, 2005
Posts: 36
Hi Joe,
What connector are you using between Tomcat and Apache?
If its mod_jk or mod_jk2, then do the following:

check the workers2.properties in your Apache/conf folder.
This files tells the Apache (using the connector) to forward the request to Tomcat

regards,
Rahul..
Rahul Singh Khokhar
Ranch Hand

Joined: Feb 23, 2005
Posts: 36
Sorry, I missed on reading your connector in your first comments.
Since you are using mod_jk, try the above by looking into workers.properties.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Got Tomcat/Apache merged, but...