tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff" <>
Subject Does mod_webapp support name-based virtual TOMCAT hosts?
Date Mon, 06 May 2002 19:42:12 GMT
I'm having a bit of a problem getting mod_webapp to work with Tomcat 4.0.3
and Apache 1.3.19.

What I'm trying to achieve:

multiple independent name-based virtual hosts (say, and for both Apache and Tomcat, each with their own
independent Tomcat webapp directories and capable of independently mapping
paths within their namespace without regard to one another. In other words, might correspond to the "foo" webapp deployed to the virtual host and be physically located at /home/i300/foo,
and might correspond to the "foo" webapp deployed to
the virtual host and be physically located at
/home/notjeff/foo.  Yes, this is a trivial example to get it to work in the
first place... the real webapps use Struts and need to be kept apart so they
won't clobber each other.

My efforts so far:

I haven't even addressed the matter of getting the second host
( to work yet, because the FIRST one continues to elude me.

My Tomcat server.xml file (below) has a more or less unchanged default
virtual host container, as well as a virtual host for "".
Going straight to Tomcat at port 8080, virtual hosts seem to be working

My Apache httpd.conf file (below) has the expected lines to use mod_webapp,
as well as a virtual host defintion for

The virtual host's Tomcat-defined appDir is /export/home/jeff/tomcat.
The virtual host's Apache-defined DocumentRoot is /export/home/jeff/tomcat.
mod_webapp is supposed to be mapping requests to
to Tomcat's "" virtual server

What's really happening -- WORKS. Apache returns the site's
index.html file, located at /export/home/jeff/tomcat/test/index.html WORKS. Tomcat returns the site's
index.jsp file, located at /export/home/jeff/tomcat/test/index.jsp and BOTH

The Warp logfile (below) reports that it was unable to deploy the
application "test" into Tomcat's (DEFAULT) webapp directory. Which appears
to uncover an even bigger problem, because it's not SUPPOSED to be deploying
the "test" application into Tomcat's default webapps directory... it's
supposed to be deploying it into's equivalent -- presumably,
/export/home/jeff/tomcat !

Is mod_webapp simply broken and unable to handle multiple sandboxed virtual
instances of Tomcat mapped to separate Apache virtual hosts, or did I do
something wrong in one of the config files?

As far as I can tell, mod_jk explicitly CAN'T do this because it can't
handle Tomcat virtual hosts, and forces all apache virtual hosts to share a
common namespace for its path mapping. So mod_jk could globally map /test
from ALL of Apache's virtual hosts to a single web app deployed to Tomcat,
but can't use the same name in different contexts to map /test to a
different webapp in a different instance for every virtual host.

I originally hacked it to work using mod_rewrite to proxy incoming requests
from port 80 to port 8080 of the appropriate virtual server, but I'd really
like to get it working the RIGHT way.


<Server port="8005" shutdown="SHUTDOWN" debug="0">
  <Service name="Tomcat-Standalone">
    <Connector className="org.apache.catalina.connector.http.HttpConnector"
               port="8080" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="60000"/>
    <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
               port="8009" minProcessors="5" maxProcessors="75"
               acceptCount="10" debug="0"/>
    <Engine name="Standalone" defaultHost="localhost" debug="0">
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
      <Realm className="org.apache.catalina.realm.MemoryRealm" />

<!-- Define the default virtual host -->
      <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="localhost_access_log."
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
        <!-- Tomcat Root Context -->
          <Context path="" docBase="ROOT" debug="0"/>
        <Context path="/manager" docBase="manager"
         debug="0" privileged="true"/>

<!-- the Virtual Host I care about... there WILL BE MORE -->
      <Host name="" debug="1"
appBase="/export/home/jeff/tomcat" unpackWARs="true">
       <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="ttest." suffix=".txt" pattern="common"/>
       <Logger className="org.apache.catalina.logger.FileLogger"
directory="/export/home/jeff" prefix="tterr" suffix=".err"
       <!-- Tomcat Root Context - DO I NEED THIS?!? -->
        <Context path="" docBase="/export/home/jeff/tomcat" debug="1"/>
        <Context path="/manager" docBase="manager" debug="0"


<!-- The WarpConnector used by mod_webapp -->
  <Service name="Tomcat-Apache">
    <Connector className="org.apache.catalina.connector.warp.WarpConnector"
     port="8008" minProcessors="5" maxProcessors="75"
     acceptCount="10" debug="1"/>

    <!-- Replace "Apache" with what your Apache "ServerName" is set to -->
    <!-- do I define an engine for each virtual host? -->
    <Engine className="org.apache.catalina.connector.warp.WarpEngine"
     name="" debug="1" appBase="test">
      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="warp." suffix=".txt"
      <!-- Because this Realm is here, an instance will be shared
globally -->
      <Realm className="org.apache.catalina.realm.MemoryRealm" />

    <!-- What's ApacheConfig for? I don't remember seeing it documented
anywhere! -->
 <ApacheConfig />



LoadModule webapp_module libexec/
AddModule mod_webapp.c
WebAppConnection tomcat warp localhost:8008


<VirtualHost *>
 DocumentRoot /export/home/jeff/tomcat/test
 ErrorLog /export/home/jeff/tomcat.err
 WebAppDeploy test tomcat /test

warp's error log --

2002-05-06 14:56:52 [org.apache.catalina.connector.warp.WarpConnector]
Connection from / to /
2002-05-06 14:56:52
[org.apache.catalina.connector.warp.WarpConfigurationHandler] Cannot find
"/usr/local/jakarta-tomcat-4.0.3-LE-jdk14/webapps/test" for appl. "test"
host ""
2002-05-06 14:56:52
[org.apache.catalina.connector.warp.WarpConfigurationHandler] Error
deploying web application "test" under <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message