You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Martin Harrigan <ma...@gmail.com> on 2008/07/03 15:52:08 UTC

Virtual Hosts and 'Hot' Redeployment

Hi all,

I have the following problem with tomcat 6.0: I have two webapps, ROOT
and myWebApp. ROOT is deployed to /var/lib/tomcat-6/webapps and has
the following entry in server.xml:

<Host name="localhost" appBase="/var/lib/tomcat-6/webapps"
unpackWARs="true" autoDeploy="true"></Host>

I can reach it fine through http://1.2.3.4/ and if I redeploy ROOT
(using the tomcat-maven-plugin), I do not need to restart tomcat.
Everything works fine.

On the other hand, myWebApp is deployed to
/var/lib/tomcat-6/webapps/myWebApp and has the following entry in
server.xml:

<Host name="otherserver" appBase="/var/lib/tomcat-6/webapps/myWebApp"
unpackWARs="true" autoDeploy="true">
<Alias>www.otherserver.com</Alias>
<Context path="" reloadable="true"
docBase="/var/lib/tomcat-6/webapps/myWebApp"/>
</Host>

I can reach it fine through http://1.2.3.4/myWebApp and through
http://www.otherserver.com. However, if I redeploy myWebApp,
http://1.2.3.4/myWebApp works fine but http://www.otherserver.com
gives a 404 resource unavailable error. The only way I can fix it is
to restart tomcat. Any ideas why a redeployed webapp might work from
http://1.2.3.4/myWebApp but not from http://www.otherserver.com?

Martin.

---------------------------------------------------------------------
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: Virtual Hosts and 'Hot' Redeployment

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Martin Harrigan [mailto:martinharrigan@gmail.com]
> Subject: Virtual Hosts and 'Hot' Redeployment
>
> Any ideas why a redeployed webapp might work from
> http://1.2.3.4/myWebApp but not from
> http://www.otherserver.com?

Your configuration is invalid, so predictable operation is not possible.  To fix the config, you first need to give each <Host> a separate, non-overlapping appBase.  Then, deploy your myWebApp as ROOT (not myWebApp) in the "otherserver" appBase.  If you then want to access the "otherserver" default webapp from localhost, create a <Context> element in conf/Catalina/localhost/myWebApp.xml with a docBase attribute whose value is the "otherserver"'s [appBase]/ROOT directory (or [appBase]/ROOT.war, if appropriate).  Note that this is a separate run-time instance of myWebApp - there's no way to avoid that.

 - 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