tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mike spisak <mspi...@pb.net>
Subject tomcat5 auto context detection
Date Mon, 05 Mar 2007 17:42:49 GMT
Hi All,

I'm trying to get tomcat to auto-recognize that I have new java 
applications (e.g. a new WEB-INF) in a sub-directory for my virtual 
hosts..  I'd like to make it so that I don't have to edit my server.xml 
every time I add a new app within some domain/sub domain...   is this 
possible?

quickie background:
- Linux Fedora Core 4, apache 2.0.54, tomcat 5, mod_jk running nicely... 
- all my domains and sub-domains are in /var/www/vhosts/<domain>
    e.g. /var/www/vhosts/example1.com/htdocs/<java stuff>     (java 
stuff = jsp files, WEB-INF directory, etc)
    e.g. /var/www/vhosts/example2.com/htdocs/<java stuff>     (java 
stuff = jsp files, WEB-INF directory, etc)
    e.g. /var/www/vhosts/example2.com/sub-domain/cool/htdocs/<java 
stuff>     (java stuff = jsp files, WEB-INF directory, etc)
       (the sub domain example would be: http://cool.example2.com)
    ....and so on...

I'd like to be able to add a new domain or sub domain, simply drop my 
app (associated jsps and WEB-INF stuff) into the appropriate directory 
of the new domain or sub domain, restart tomcat and *poof* have it 
work.... 

so my server.xml snippet looks like this:

-- I tried having defaultHost = localhost..  didn't really work, when I 
tried sub-domains I got "no host matches server name"
-- My logic behind putting the "appBase" to vhosts, was so that tomcat 
could scan everything after that, and thus when it encounters a WEB-INF 
it would make it a context.. but not sure how that context would map to 
a specific domain...  (hence the "deployOnStartup" = true)
-- I added a context for example1.com which works..  but don't want to 
have to add one every time...

    <Engine name="PSA" defaultHost="example1.com" debug="0">
      <Host deployXML="true" name="example1.com" debug="0"
          appBase="/var/www/vhosts" unpackWARs="false" autoDeploy="true"
          liveDeploy="true" deployOnStartup="true">
            <!-- added a context, but don't want to.. -->
            <Context crossContext="false"
            reloadable="false" useNaming="true" debug="0" 
swallowOutput="false"
            privileged="true" displayName="my app"
            docBase="/var/www/vhosts/example1.com/htdocs" cookies="true"
            path="" cachingAllowed="true"/>
            <Realm className="org.apache.catalina.realm.MemoryRealm" 
debug="0" pathname="my-users/example1.com.xml" validate="true"/>
            <Alias>
        www.example1.com
            </Alias>
      </Host>
    </Engine>

...also, wondering about cooperation between apache and tomcat... 

thanks in advance,
Mike


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message