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/12 16:59:43 UTC

How to create a virtual host with war file without beeing created a ROOT dir?

Hi,
I've been developing an application with this structure of directories	

mydir/html/
mydir/html/WEB-INF
mydir/html/WEB-INF/classes
mydir/html/WEB-INF/lib
mydir/html/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">
	<Context path="" reloadable="true" docBase="/myhost/html"/>
</Host>

And everything works fine.

The problem comes now that I want to put my application in another machine
and I want to do it with a war file.

What I've done es to take the directory mydir/html and create the html.war.
Then I changed the host by this one:
<Host name="myhost.es" appBase="/myhost" unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
	<Context path="" reloadable="true" docBase="/myhost/html"/>
</Host>

But now, when I start tomcat, it creates the directories mydir/html and
mydir/ROOT. The application seems to work indeed but, how can I avoid the
system create de ROOT directory? Probably I'm not doing this in the correct
way.

I want to access my application at the URL myhost.es and not at
myhost.es/html.

Thanks
-- 
View this message in context: http://www.nabble.com/How-to-create-a-virtual-host-with-war-file-without-beeing-created-a-ROOT-dir--tp23504283p23504283.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


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

Posted by raistlink <el...@gmail.com>.
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


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

Posted by André Warnier <aw...@ice-sa.com>.
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


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

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> 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.

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org