You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mike spisak <ms...@pb.net> on 2007/03/05 22:26:22 UTC

tomcat5 auto content detection

Sorry if re-post - I think this got buried in a reply to a different 
post....   either way:

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


RE: tomcat5 auto content detection

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: mike spisak [mailto:mspisak@pb.net] 
> Subject: tomcat5 auto content detection
> 
> 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...

If by "sub domain" you mean some part of a webapp path - there is no
such thing.  Webapps are complete entities; the servlet spec does not
allow for them to be broken up into "sub domains".  All webapps must be
deployed in the <Host>'s appBase directory, or their deployment location
can be specified via a docBase attribute in a <Context> element located
in an conf/Catalina/[host]/[appName].xml file.

Or maybe you mean something else by "sub domain"?

If you change .class files within a webapp, you must reload it for those
updates to be recognized.  You can change .jsp files on the fly, and
those modifications are normally recognized immediately (unless disabled
in the JSP servlet configuration).

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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