You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by raistlink <el...@gmail.com> on 2009/05/13 11:39:29 UTC

Re: How to create a virtual host with war file without beeing created aROOT dir?

Thank you for your answers, the versions is apache-tomcat-6.0.16, sorry.

I'll try to make the things as you say.

Thanks!!



awarnier wrote:
> 
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-create-a-virtual-host-with-war-file-without-beeing-created-a-ROOT-dir--tp23504283p23518575.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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