> From: Eric P [mailto:eric.maill...@gmail.com]
> Subject: Re: Virtual host set-up woes
> 
> But I only get an blank page for a simple index.jsp file 

Indicative of a messed up configuration that doesn't have a default webapp.

> $CATALINA_HOME/conf/server.xml
>      <Host name="http:// dummy. com" appBase="dummyapps"

The above is ok, assuming the spaces are in there just to keep the spam filter 
happy.

>          <Logger className="org.apache.catalina.logger.FileLogger"
> directory="logs" prefix="dummy_access_log"
> suffix=".log" timestamp="true"/>

There hasn't been a <Logger> element in Tomcat in many years; where did you get 
that from?  Be wary of any "documentation" that doesn't come from the Tomcat 
web site - it's often out of date, and much of it is bogus.

> /etc/hosts
> 127.0.0.1       localhost       dummy. com

Good (except for the space, of course).

> $CATALINA_HOME/conf/Catalina/dummyapps/ROOT.xml

Where did you get that location for a <Context> element?  It certainly didn't 
come from the docs, nor from Peter's or my messages.  Go back and reread them 
all.  To quote from Peter's message:

> > create a file in $tomcathome/conf/Catalina/yourhost called ROOT.xml

The name of your <Host> is?  (It's certainly not dummyapps.)  Tomcat would have 
completely ignored a file in the above location.

> <Context>
>      <WatchedResource>WEB-INF/web.xml</WatchedResource>
> </Context>

Does that look at all like the <Context> element Peter provided?  To refresh 
your memory, here it is again (with the invalid path attribute removed):

> > <Context docBase="$tomcathome/somewhereNotInTheAppbase/myapp.war"
> > reloadable="true">

Note the presence of the docBase attribute and the comment therein.

Also, it's pointless to have a <WatchedResource> of WEB-INF/web.xml in your 
<Context> element, since that value is already in the global one.  If you have 
nothing to put in a <Context> element, you don't need one.

> And the directory structure for the new context home (the content a
> built/deployed app I copied over from its old location in /webapps).
> $CATALINA_HOME/dummyapps
> $CATALINA_HOME/dummyapps/WEB-INF
> $CATALINA_HOME/dummyapps/index.jsp
> $CATALINA_HOME/dummyapps/(other static files)

Which is still very wrong.  The appBase directory is the default location for 
all of a <Host>'s webapps - there can be many.  The default webapp for a <Host> 
must be named ROOT (case sensitive), and is located either under the <Host> 
appBase directory, or where the <Context> docBase attribute points in the 
conf/Catalina/[host]/ROOT.xml file.

Peter's message shows one way to achieve what you want, and facilitates the use 
of the same .war file or directory as the default one for each <Host> (the 
docBase attribute of all the ROOT.xml files would point to the same place).  If 
in fact you want to use a different default webapp for each <Host>, you can 
separate them by the appBase setting of each <Host>, and not place the ROOT.xml 
file in conf/Catalina/[host].  In this scenario, your structure would be:

host1apps/ROOT/
host1apps/ROOT/WEB-INF/
host1apps/ROOT/WEB-INF/lib/
host1apps/ROOT/WEB-INF/classes/
host1apps/ROOT/WEB-INF/web.xml
host1apps/ROOT/META-INF/
host1apps/ROOT/META-INF/context.xml
host1apps/ROOT/index.jsp
host1apps/ROOT/<anything else needed>

host2apps/ROOT/
host2apps/ROOT/WEB-INF/
host2apps/ROOT/WEB-INF/lib/
host2apps/ROOT/WEB-INF/classes/
host2apps/ROOT/WEB-INF/web.xml
host2apps/ROOT/META-INF/
host2apps/ROOT/META-INF/context.xml
host2apps/ROOT/index.jsp
host2apps/ROOT/<anything else needed>

...

The <Context> element for each webapp should be in the webapp's 
META-INF/context.xml file.  Additional webapps (if any) for each <Host> would 
be placed in directories named for the webapp under host1apps, host2apps, etc.

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

Reply via email to