You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Stanish, Brian" <Br...@infores.com> on 2002/06/10 16:58:17 UTC

tomcat-apache with webapp connector

I am using Tomcat 4.0.3 with Java SDK 1.4.0 along with Apache 1.3.24. These are all running on a RedHat 7.2 box on which I do have root access. 

I have followed the readme and install files and managed to get Tomcat working standalone. Then I installed mod_webapp as a shared object for Apache and edited my httpd.conf file to use that module:

*********************
LoadModule webapp_module /etc/httpd/modules/mod_webapp.so
AddModule mod_webapp.c

<IfModule mod_webapp.c>
    WebAppConnection conn      warp  127.0.0.1:8008
    WebAppDeploy     examples    conn  /examples
    WebAppDeploy     manager     conn  /manager
    WebAppInfo /webapp-info
</IfModule>
*********************

I am able to access tomcat by going to the URL myhost.mydomain.com:8080 and I can access $tomcat_root/examples and $tomcat_root/manager by going to myhost.mydomain.com/examples/ and myhost.mydomain.com/manager/ respectively. 

What I would like to do however, is allow .jsp files (and eventually servlets as well) in my html root. Currently if I have a file such as myhost.mydomain.com/foo.jsp, apache returns it as source text. I have looked for a way to tell apache that if it finds a jsp file it should send it to tomcat for processing, but all I have found on the web and in newsgroups is how to do it using either jserv or jk. Current documentation has recommended using webapp as a connector, which is why I installed it, but does it disallow me from having jsp's in my docroot? Any pointers would be appreciated. 

Thanks in advance.

-Brian

Re: tomcat-apache with webapp connector

Posted by Jean-Luc BEAUDET <be...@toolchest.cyber.kodak.com>.
"Stanish, Brian" a écrit :

> I am using Tomcat 4.0.3 with Java SDK 1.4.0 along with Apache 1.3.24. These are all running on a RedHat 7.2 box on which I do have root access.
>
> I have followed the readme and install files and managed to get Tomcat working standalone. Then I installed mod_webapp as a shared object for Apache and edited my httpd.conf file to use that module:
>
> *********************
> LoadModule webapp_module /etc/httpd/modules/mod_webapp.so
> AddModule mod_webapp.c
>
> <IfModule mod_webapp.c>
>     WebAppConnection conn      warp  127.0.0.1:8008
>     WebAppDeploy     examples    conn  /examples
>     WebAppDeploy     manager     conn  /manager
>     WebAppInfo /webapp-info
> </IfModule>
> *********************
>
> I am able to access tomcat by going to the URL myhost.mydomain.com:8080 and I can access $tomcat_root/examples and $tomcat_root/manager by going to myhost.mydomain.com/examples/ and myhost.mydomain.com/manager/ respectively.
>
> What I would like to do however, is allow .jsp files (and eventually servlets as well) in my html root. Currently if I have a file such as myhost.mydomain.com/foo.jsp, apache returns it as source text.

Well it seems that your jsp files are not treated at all...
First of all yu do have to well understand how deployments are done under Tomcat.

/examples works well because, basically, your tomcat is pre-configured to work this way.
The ServerROOT for Tomcat is under /path/to/Tomcat/webapps.

When Tomcat is started, it looks in that directory and deploy every "web application" found. In that case,
examples ROOT manager tomcat-docs and eventually webdav.
This deployement is controlled by the $TOMCAT_DIR/server.xml and web.xml.

So try first to execute sample codes from the /examples deployement and look if it goes right.
You can see it too in $TOMCAT_DIR/work/127.0.0.1/ directoty.

> I have looked for a way to tell apache that if it finds a jsp file it should send it to tomcat for processing,

Once mod_webapp is compiled, well installed and declared as a shared module, Apache knows that all jsp's are to be sent to this module, according, obviously, to the Deployment done.

About the deployment, i was talking of the part dedicated to Tomcat-Apache which is handled in your case by mod_webapp on server 127.0.0.1 ( hum, yu can forget it assuming that it is the default...) on port 8008.
So that each Host and Context declared in this part AND WebAppDeployed in httpd.conf will be concerned.

Yu may keep the structure described in THE 2.3 API Servlet:
/path/to/my/zone/webapps containing folders below:
./jsp  put jsp's files
./servlets for yur servlets
./WEB-INF/classes all .class files
./WEB-INF/lib all .jar files
./WEB-INF/web.xml describing how to handle yur jsp and servlets.

Don't forget that with no personal web.xml under WEB-INF, the deployer will  understand that yu want to use the default one; that is $TOMCAT_DIR/conf/web.xml.
For instance it says that a common servlet will be call by http://myserver/servlet/MyServlet.


> but all I have found on the web and in newsgroups is how to do it using either jserv or jk. Current documentation has recommended using webapp as a connector, which is why I installed it, but does it disallow me from having jsp's in my docroot? Any pointers would be appreciated.

Try to read the online documentation directly on yur server port 8080 ( if available) or go to the jakarta online doc
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/index.html


>
>
> Thanks in advance.
>
> -Brian

Hope this help.

Jean-Luc :O)



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>