tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: How to create a virtual host with war file without beeing created aROOT dir?
Date Tue, 12 May 2009 18:30:24 GMT
Caldarale, Charles R wrote:
>> From: raistlink [mailto:elamas@gmail.com]
>> Subject: How to create a virtual host with war file without beeing
>> created aROOT dir?
>>
>> I've been developing an application with this structure of directories
> 
> Care to tell us the version of Tomcat you're using?  Or should we just guess?
> 
> The above is incorrect; set it up like this:
> 
> mydir/html/ROOT
> mydir/html/ROOT/WEB-INF
> mydir/html/ROOT/WEB-INF/classes
> mydir/html/ROOT/WEB-INF/lib
> mydir/html/ROOT/WEB-INF/web.xml
> 
>> At server.xml I've included this host:
>>
>> <Host name="myhost.es" appBase="/myhost/html" unpackWARs="true"
>> autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
> 
> With the above directory changes, your <Host> settings are o.k.
> 
>> 	<Context path="" reloadable="true" docBase="/myhost/html"/>
> 
> The <Context> is completely wrong:
> 
> 1) Don't put <Context> elements in server.xml - that's extremely bad practice unless
you're using an ancient level of Tomcat.
> 
> 2) The <Context> element should be in the webapp's META-INF/context.xml file; in
your case, that will be mydir/html/ROOT/META-INF/context.xml.
> 
> 3) The docBase attribute (when used, which is rarely) must *never* be the same as appBase.
> 
> 4) For your case, the path and docBase attributes are not allowed when the <Context>
element is in the proper location; remove them.
> 
>> And everything works fine.
> 
> Not really; there are bugs in certain versions of Tomcat that make it appear to work.
 You're also getting double application deployment and have serious security holes with your
current setup.
> 
>> What I've done es to take the directory mydir/html and create the
>> html.war.
> 
> Change the name to ROOT.war.
> 
>> Then I changed the host by this one:
>> <Host name="myhost.es" appBase="/myhost" unpackWARs="true"
>> autoDeploy="true"
>> xmlValidation="false" xmlNamespaceAware="false">
> 
> The above is o.k.
> 
>> 	<Context path="" reloadable="true" docBase="/myhost/html"/>
> 
> This is bad, for the reasons stated above.  Correct it as noted above.
> 

What I don't get in all this, is how it works, what with the application 
located in /mydir/html and the Tomcat appBase in /myhost/html.

What version of Tomcat is that ? It's *really* smart.
;-)

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


Mime
View raw message