aspose file tools*
The moose likes Servlets and the fly likes Apache-Tomcat Integration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Apache-Tomcat Integration" Watch "Apache-Tomcat Integration" New topic
Author

Apache-Tomcat Integration

Venkat Manne
Greenhorn

Joined: May 18, 2001
Posts: 10
I want to integrate Tomcat3.2.1 and Apache1.3.9 to work with JSP and Oracle. I have installed mod_jserv also as server adapter. Appropriate changes were done in the tomcat.conf file in Tomcat and httpd.conf of Apache.
In httd.conf the following lines were added:
include d:/jakarta-tomcat-3.2.1/conf/tomcat-apache.conf
include d:/jakarta-tomcat-3.2.1/conf/tomcat.conf
I start Tomcat and then Apache, in starting Apache I get the syntax error in line where the line is
ApjServManual on
Could you help me out!!!
Thanks in advance,
Suresh.
Xavier VS
Greenhorn

Joined: May 11, 2001
Posts: 7
hi,
U have to download ApacheServModule.dll (not sure about he name)
from jakarta.apache.org
and put in a folder .
read the installation notes for tomcat server.
Xavier
Venkat Manne
Greenhorn

Joined: May 18, 2001
Posts: 10
Originally posted by Xavier VS:
hi,
U have to download ApacheServModule.dll (not sure about he name)
from jakarta.apache.org
and put in a folder .
read the installation notes for tomcat server.
Xavier

Thanks for ur reply,I have installed ApacheJservModule.dll . I placed my Html and Jsp files in the htdocs directory of Apache. I am not able to redirect the request to Tomcat for serving the dynamic content. My request is being served if I place the Jsp file in Tomcat's webapps/examples/... directory. How could I respond for a request for JSP file without placing it in Tomcat?
Ganesh Anekar
Ranch Hand

Joined: May 13, 2001
Posts: 36
hi there,
Mail me i will give u entire files regarding this.
bye
regards
ganesh
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Here is a short snip from a document I made for myself after a few weeks of figuring things out.
Tomcat uses server.xml to load up contexts. A context in simplest terms, is that which appears after http://localhost:8080/ By default, Tomcat will create a context with the same name as each of the folders under the webapps directory. So if you want to group together a "JSP application" under http://localhost:8080/mySite then place the mySite folder inside of webapps, and Tomcat will create this context for you. If your folder is somewhere else on the hard drive, you can still have Tomcat load it, but you must specify it in server.xml


Partial listing of server.xml...
NOTE: It is very important to place Context statements within the appropriate XML tags. You must place a new <Context> tag within the <ContextManager> tag.
.
.
.
<Context path="/mySite"
docBase="C:\aFolder\someFolder\myFolder"
debug="0"
reloadable="true">
</Context>

Hopefully you can manage to understand how to modify this file.
Venkat Manne
Greenhorn

Joined: May 18, 2001
Posts: 10
Thanks a lot Mike.
It really worked, I am able to direct my request for .jsp to Tomcat. But I am hooked up with another problem in porting it completely. I have some .class files for .jsp . Earlier I placed them in "\webapps\examples\WEB-INF\classes" of Tomcat, It was fine. Where should i place my class files now in Apache to make my Apache+Tomcat serve the .jsp file.
Thanks in advance,
Manne.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

same place as before, you shouldn't have to move them.

In your case, your 'JSP application' is the entire folder 'examples'. You can move this entire folder intact to anywhere on your harddrive, including the Apache htdocs directory. As long as you specify in web.xml for Tomcat, then the class files will be found.

I have tested this on my system. It works. My web.xml looks like this...
Venkat Manne
Greenhorn

Joined: May 18, 2001
Posts: 10
Hi,
There was not much success this time..and I am repeatedly getting the same error. I placed my Java Class files directory as before ie in "\webapps\examples\WEB-INF\classes" and modified the web.xml file by adding the following lines:
<ContextManager debug="0" workDir="work" showDebugInfo="true" >
<Context path="\mysite"
docBase="c:\Program Files\Apache Group\Apache\htdocs\mysite"
crossContext="false"
debug="0"
reloadable="true" >
</Context>
</ContextManager>
The error I get is:
org.apache.jasper.JasperException: Unable to compile class for JSPD:\jakarta-tomcat-3.2.1\work\localhost_8080%2Falscsite\_0002fsearch_0002fparaSearch_0002ejspparaSearch_jsp_0.java:16: Package pool not found in import.
where "pool" is my folder of class files placed in the directory mentioned earlier.
Please help me out,
Manne.

[This message has been edited by Venkat Manne (edited May 31, 2001).]
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

One small thing... it should be <Context path="/mysite" not \mysite

This sounds like a packaging problem. Before you moved directories around, did you have this web application working at all? I can't see the JSP import statement, but let's say you have <%@ page import="pool.myPoolClasses.PoolMgr"%>

then under the web-inf/classes directory, you'd have to have pool/myPoolClasses/PoolMgr.class

And also, PoolMgr.java would need the package statement 'package pool.myPoolClasses;'

If all of this is done (if this site worked before you moved it) then I'm not sure of the problem.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Wait, I just realized something.

You have your class files in the wrong web application.

You have to consider each folder under webapps as separate and distinct. Tomcat does. If you place class files for application 'a' in the web-inf/classes folder of application 'b', then they will not be found.

If your site is: docBase="c:\Program Files\Apache Group\Apache\htdocs\mysite"

Then you need a mysite/web-inf/classes folder, and move your 'pool' folder here.
Venkat Manne
Greenhorn

Joined: May 18, 2001
Posts: 10
Earlier I placed 'mysite' in "\webapps\examples\" and the class files as said in my earlier note. Now "mysite" is shifted to "\htdocs\" of Apache. My class files fails to get imported. I created the seperate directory as shown above by you. Still they are failing. Any suggestions to continue..hope some from you.
Thanks in advance,
Manne.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Just so it's clear:

This is what you should have - A directory structure like this:
C:/Program Files/Apache Group/Apache/htdocs/mySite/web-inf/classes

A web.xml file that contains this:
Your jsp pages should be under:
C:/Program Files/Apache Group/Apache/htdocs/mySite
Your class files should be in their proper directories (matching their respective packages) starting:
C:/Program Files/Apache Group/Apache/htdocs/mySite/web-inf/classes

If all of this is so, then I don't know what the problem is. Make sure you have your *.class file at the correct level in the folders. Other than that, I don't know what's wrong.
[This message has been edited by Mike Curwen (edited May 31, 2001).]
Venkat Manne
Greenhorn

Joined: May 18, 2001
Posts: 10
Thanks a lot Mike.
It really worked, I am able to redirect the requests and everything is fine. Hope to talk to you soon.
Thanks again,
Suresh.
 
Don't get me started about those stupid light bulbs.
 
subject: Apache-Tomcat Integration