tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Kilbride" <>
Subject Re: apache vhost->mod_jk->servlet container
Date Sun, 08 Apr 2001 04:00:01 GMT
Here's an example of the setup I have running (info changed to be

        DocumentRoot "/home/websites/tld"

        JkMount /servlet/* ajp13
        JkMount /*.jsp ajp13

        Alias /mywebapp "/path/to/your/webapp/mywebapp"
        <Directory "/path/to/your/webapp/mywebapp">
                allow from all

        <Location "/mywebapp /WEB-INF">
                AllowOverride None
                deny from all

        <Location "/mywebapp /META-INF">
                AllowOverride None
                deny from all


<!-- Virtual host setup -->
<Host name="" >
    <Context path=""
                    reloadable="true" >

I noticed you had the DocumentRoot for Apache set to the same directory as
your docBase. Is that really what you want? I usually try to keep these two
separate. Since the docBase represents the top-level of my webapp, I usually
alias the docBase to a relative path with a meaningful name -- so people
access it from the web as, as opposed to
I'm not even sure if having the docBase and DocumentRoot the same will work.
I've never tried it that way. (Does anybody know?)

Also, you don't need to declare the "/servlet" context explicitly. The above
config will give the following:
    access to DocumentRoot in httpd.conf
    access to the docBase in server.xml
    ability to run JSP files in the docBase directory
    access to servlets/JSP in your WEB-INF/classes directory
    ability to run servlets/JSP from WEB-INF/classes

Your servlet mappings in your web.xml file below are correct. I got all of
this from the Apache-Tomcat and mod_jk Howto's located here:

I had to read them a couple of times and switch back and forth through the
examples, before it really made sense.

Hope this helps!


----- Original Message -----
From: <>
To: <>
Sent: Saturday, April 07, 2001 7:03 PM
Subject: apache vhost->mod_jk->servlet container

> Hi All!
> This is my first post, so bear with me.
> I've been struggling with this problem for
> awhile.  I'm trying to get tomcat to handle
> servlet requests outside of
> I am trying to do this because I have multiple
> apache vhosts pointing to multiple server
> paths for what needs to be multiple servlet
> containers.  Here are some example server
> paths to
> demonstrate my point...
> /home/
> /home/
> ...I have already setup the following files
> like so and actually have jsp working in my
> multiple server paths no problem.  It's the
> servlet directories that aren't working and
> just give me error
> 404.
> httpd.conf...
> *all irrelevant information stripped*
> <VirtualHost>
> DocumentRoot /home/
> blic_html
> ServerName
> JkMount /*.jsp ajp13
> JkMount /servlet/* ajp13
> </VirtualHost>
> server.xml...
> <Host name="">
> <Context path=""
> docBase="/home/
> _html" debug="0"/>
> <Context path="/servlet"
> docBase="/home/
> _html/servlet" debug="0"/>
> </Host>
> ....despite what looks to me like a proper
> configuration, when I point my web browser at
> texample i get a 404 error.  I imagined at
> first
> this was because i didn't declare the servlet
> in web.xml.  So I copied it
> to /home/
> servlet and declared a servlet like so...
> <servlet>
> <servlet-name>
> hello
> </servlet-name>
> <servlet-class>
> HelloWorldExample
> </servlet-class>
> </servlet>
> <servlet-mapping>
> <servlet-name>
> hello
> </servlet-name>
> <url-mapping>
>  /hello
> </url-mapping>
> </servlet-mapping>
> dice still didn't work.  There seems to
> be very little documentation on this sort of
> thing, and what it boils down to is I'm trying
> to make tomcat host multiple servlet
> containers.  Any
> ideas?
> Brendon

View raw message