tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abraham Fathman" <afath...@one.net>
Subject RE: Does mod_webapp support name-based virtual TOMCAT hosts?
Date Tue, 07 May 2002 01:38:03 GMT
Jeff,

I have this working with a very similar configuration. First of all the
virtual-hosts you have are defined in the Tomcat-Standalone section -
therefore they don't apply to mod_webapp which is only the Tomcat-Apache
section.

Second,
According to your httpd.conf you are trying to connect to a webapp
called test. Try changing your WebAppDeploy in httpd.conf to say:

    WebAppDeploy     examples  conn  /examples/

After restarting apache try
http://tomcat.i300.net/examples/jsp/index.html

When using mod_webapp all of the virtual hosting is done in httpd.conf.
Every web app that is deployed will use it's own classloader and
therefore it's own static variables, application object, etc...

This means that you could deploy the SAME application under two
different virtual hosts and they couldn't share static variables.

Let me know if this helps,

Abraham

-----Original Message-----
From: Jeff [mailto:jefflists@tiaxa.net] 
Sent: Monday, May 06, 2002 3:42 PM
To: tomcat-user@jakarta.apache.org
Subject: Does mod_webapp support name-based virtual TOMCAT hosts?


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, tomcat.i300.net and
notjeff.i300.net) 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, tomcat.i300.net/foo might correspond to the "foo" webapp
deployed to the tomcat.i300.net virtual host and be physically located
at /home/i300/foo, and notjeff.i300.net/foo might correspond to the
"foo" webapp deployed to the notjeff.i300.net 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
(notjeff.i300.net) 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 "tomcat.i300.net".
Going straight to Tomcat at port 8080, virtual hosts seem to be working
properly.

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

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 http://tomcat.i300.net/test to Tomcat's "tomcat.i300.net" virtual
server

What's really happening --

http://tomcat.i300.net/index.html WORKS. Apache returns the site's
index.html file, located at /export/home/jeff/tomcat/test/index.html

http://tomcat.i300.net:8080/index.jsp WORKS. Tomcat returns the site's
index.jsp file, located at /export/home/jeff/tomcat/test/index.jsp

http://tomcat.i300.net/test and http://tomcat.i300.net/test/index.jsp
BOTH HANG.

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 tomcat.i300.net'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.


*********************************************************
WEB.XML --

<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"
              timestamp="true"/>
      <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."
suffix=".txt"
                 pattern="common"/>
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
         timestamp="true"/>
        <!-- Tomcat Root Context -->
        <!--
          <Context path="" docBase="ROOT" debug="0"/>
        -->
        <Context path="/manager" docBase="manager"
         debug="0" privileged="true"/>
      </Host>

<!-- the Virtual Host I care about... there WILL BE MORE -->
      <Host name="tomcat.i300.net" 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"
timestamp="true"/>
       <!-- Tomcat Root Context - DO I NEED THIS?!? -->
       <!--
        <Context path="" docBase="/export/home/jeff/tomcat" debug="1"/>
       -->
        <Context path="/manager" docBase="manager" debug="0"
privileged="true"/>
      </Host>

    </Engine>
  </Service>

<!-- The WarpConnector used by mod_webapp -->
  <Service name="Tomcat-Apache">
    <Connector
className="org.apache.catalina.connector.warp.WarpConnector"
     port="8008" minProcessors="5" maxProcessors="75"
     enableLookups="true"
     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="tomcat.i300.net" debug="1" appBase="test">
      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="warp." suffix=".txt"
              timestamp="true"/>
      <!-- Because this Realm is here, an instance will be shared
globally -->
      <Realm className="org.apache.catalina.realm.MemoryRealm" />
    </Engine>

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

  </Service>
</Server>


******************************************************************
HTTPD.CONF --


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

#...

<VirtualHost *>
 ServerAdmin jeff@tiaxa.net
 DocumentRoot /export/home/jeff/tomcat/test
 ServerName tomcat.i300.net
 ErrorLog /export/home/jeff/tomcat.err
 WebAppDeploy test tomcat /test
</VirtualHost>


***************************************
warp's error log --

2002-05-06 14:56:52 [org.apache.catalina.connector.warp.WarpConnector]
Connection from /127.0.0.1:34274 to /127.0.0.1:8008
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 "tomcat.i300.net" 2002-05-06 14:56:52
[org.apache.catalina.connector.warp.WarpConfigurationHandler] Error
deploying web application "test" under <http://tomcat.i300.net:80/test/>



--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message