tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William Holloway" <>
Subject Re: Problem setting server.xml <host> <context> field.
Date Mon, 08 Jan 2007 20:25:09 GMT
I'm attempting a very similar setup and have been successful using the
info described here. Thanks for providing the detailed walk-through.

I have a follow up question, though. Is the use the name ROOT required
for the WAR or is there another way to specify the default context for
the Host? I ask because the our development environment uses only the
localhost Host and being able to copy WARs from the webapps dir of dev
server to the appBase of the prod environment without refactoring
would be really nice. I've tried editing the context after exploding
the war to the empty path attribute but this doesn't work. Oddly
enough, this does work if the context info is copied from the
context.xml file and pasted into server.xml (followed by a restart of

ie this works:

  <Host name="" appBase="/vhosts/zorp" autoDeploy="false">
      	<Context path="" docBase=""  reloadable="true">

where as this does not
 <Host name="" appBase="/vhosts/zorp" autoDeploy="false">

 and $CATALINA_HOME/conf/Catalina/ is

	<Context path="" docBase=""  reloadable="true">

Many thanks,

On 1/3/07, Caldarale, Charles R <> wrote:
> > From: Jacob Rhoden []
> > Subject: Re: Problem setting server.xml <host> <context> field.
> > I would like to use virtual hosts so that:
> > maps to
> > maps to
> The preliminary question is: do you really need to use httpd or other
> front end to Tomcat at all?  Response will generally be faster without
> something else up front adding path length.  If you do need to front end
> Tomcat, someone else will have to help you with that config, since I
> have very, very limited experience with mod_jk.
> Proceeding with a stand-alone config, the first step is to read the
> docs, if you haven't already done so:
> You should have two <Host> elements with name attributes "" and
> "" respectively in server.xml, inside the <Engine> element.
> One of your <Host> names must be declared to be the default one in your
> <Engine> element, since some requests may come in via IP address rather
> than a name.  (You could always define a third one - such as the
> existing localhost - for that purpose.)  You only need one <Connector>
> inside your <Engine>; it will handle requests for all <Host>s.  If you
> get rid of the front end and mod_jk, just use the HTTP version and set
> the port number to 80.
> The two (or three) <Host> elements should use unique appBase settings to
> avoid overlapping deployments; for example, you could use
> and (leaving the plain webapps for
> the third default <Host> if you go that way).  The default app for each
> <Host> should be deployed under its appBase directory in the ROOT
> subdirectory (or as ROOT.war) - note that this name is case sensitive.
> So, your index.jsp files would be located in
> and
> for Application1 and Application2, respectively, along with the rest of
> the components of each app.
> You likely do not need <Context> elements for your apps, since Tomcat
> uses the name of the deployment directory to derive the URL path for the
> app, with ROOT being the required alias for the default app (what used
> to be specified with an empty string path attribute).  If you really
> have to use <Context> elements, they should be placed in context.xml
> files in each app's META-INF directory (in the ongoing example, that
> would be and
>  Such <Context> elements
> must not contain path or docBase attributes.
> You can also choose to deploy your apps outside of the <Host> appBase
> directories.  If you wish to do so, you will need ROOT.xml files in
> conf/Catalina/ and conf/Catalina/  Each of these
> ROOT.xml files must contain a single <Context> element with a docBase
> attribute pointing to the location of each <Host>'s respective default
> app.  Again, the path attribute must not be used.
>  - Chuck
> 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:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message