Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For the files you listed, the simple answer assuming you are using all the defaults, the order is (note the <strong>conf</strong>/Catalina/localhost):</p> <pre><code>...tomcat/conf/context.xml ...tomcat/conf/Catalina/localhost/myapp.xml ...tomcat/webapps/myapp/META-INF/context.xml </code></pre> <p>I'm basing this (and the following discussion) on the <a href="http://tomcat.apache.org/tomcat-5.5-doc/config/context.html" rel="noreferrer">Tomcat 5.5 official documentation for the <strong>Context Container</strong></a>. </p> <p>So if that's the simple answer, whats the complete answer?</p> <p>Tomcat 5.5. will look in a couple of other places for <code>&lt;Context&gt;</code> elements beyond those you've listed (see the official docs).</p> <p>The <code>META-INF/context.xml</code> will never be opened if Tomcat finds a <code>Catalina/localhost/myapp.xml</code>. So if you actually have all the files above, its more correct to say the the <code>META-INF/context.xml</code> is <strong>irrelevant</strong>, not that it's the lowest precedence.</p> <p>If you say <code>&lt;Context override="true" ...&gt;</code> in your <code>Catalina/localhost/myapp.xml</code> that will make it the <strong>highest</strong> precedence, regardless of <code>conf/context.xml</code>. Same thing in your <code>META-INF\context.xml</code>, as long as you don't have a <code>Catalina/localhost/myapp.xml</code> (see previous paragraph).</p> <p>Also, the <code>/Catalina/localhost/</code> portion of the path in the files above actually comes out of the "default" <code>conf/server.xml</code> and matches the <code>&lt;Engine name="Catalina" defaultHost="localhost"&gt;</code>. If your <code>server.xml</code> uses different values for <code>name</code> and <code>defaultHost</code> in the <code>&lt;Engine&gt;</code>, that's the dir structure where Tomcat will look.</p> <p>Finally, for the <code>...tomcat\</code> portion of the files you listed, Tomcat uses the dir from the <code>$CATALINA_BASE</code> environment variable. If that's not set, then it uses the dir from the <code>$CATALINA_HOME</code> environment variable, which is the directory of the Tomcat installation. I like to set and use <code>$CATALINA_BASE</code> so that I don't "pollute" my Tomcat installation.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload