> That isn't quite how it works.
> $CATALINA_HOME/conf/context.xml
> provides global defaults which can be overridden at the host level by:
> $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.defaultfile
> which in turn can be overridden at the context level by:
> $CATALINA_HOME/conf/[enginename]/[hostname]/<contextpath>.xml
>
> If a <contextpath>.xml exists, it always takes priority over anything in a
> WAR or an exploded directory.
>
> > Is there a different handling for packaged webapps (wars) vs. an exploded
> > directory?
> There is a slight one. For WARs with a context.xml, it will get copied to
> $CATALINA_HOME/conf/[enginename]/[hostname]/ if a <contextpath>.xml does
> not exist.
> context.xml files in an exploded directory do not get copied. This is an
> inconsistency that is on my list to fix as part of fixing
> https://issues.apache.org/bugzilla/show_bug.cgi?id=42747
>
> Mark
>

Ok cool. Thank you very much for clearing that up for me. The first time I
deployed the war, there wouldn't have been a context in any of the 3
locations mentioned above. As you said, it would have copied the context.xml
file from the war into the 3rd location as <contextpath>.xml correct?

I looked at in $CATALINA_HOME/conf/[enginename]/[hostname]/, and sure enough
there is a mywar-snapshot.xml. When I look at the contents of that file it
it contains this:
[quote]
<Context path="/mywar" />
[/quote]

So in this case the file-name itself is actually used rather than the path
specified in this file?

I know you quoted this from the documentation, I just wanted to clarify that
this is what it meant.

My understanding aside, this seems a bit counter-intuitive to me. Why
recommend the use of the context.xml if it really isn't used? I'll be honest
I have very little experience deploying using a war, I usually deploy as an
exploded directory, but I always had the impression the name of file was
used as a default case when a more specific context.xml wasn't present.

In either case, thank you very much for the help.

Cheers,
Eric

-- 
Learn from the past. Live in the present. Plan for the future.
11101000
http://www.townsfolkdesigns.com/blogs/elberry

Reply via email to