title: Understanding context.xml in tomcat 6
body: <p>I created a mainly empty dynamic web project in eclipse.</p>
  
  <p>It has</p>
  
  <ul>
  <li>no servlets</li>
  <li>no jsp files</li>
  </ul>
  
  <p>The web.xml is </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
    &lt;display-name&gt;testprojekt&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>and I added a <code>context.xml</code> to its <code>META-INF</code> folder</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context&gt;
          &lt;Parameter name="companyName" value="My Company, Incorporated"  override="false"/&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>I exported this project as a WAR file. With the following structure:</p>
  
  <pre><code>user@system:$ tree
  .
  |-- META-INF
  |   |-- MANIFEST.MF
  |   `-- context.xml
  `-- WEB-INF
      |-- classes
      |-- lib
      `-- web.xml
  
  4 directories, 3 files
  </code></pre>
  
  <p>When I deploy the project to a local tomcat (Apache Tomcat/6.0.20) Everything works as expected. Meaning, the context.xml is copied to /conf/Catalina/localhost and renamed to testprojekt.xml.</p>
  
  <p>When I edit the testprojekt.xml to:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context&gt;
    &lt;Parameter name="companyName" value="My BLAH Company, Incorporated"  override="false"/&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>I see the following output in the catalina.out:</p>
  
  <pre><code>02.11.2009 13:21:35 org.apache.catalina.startup.HostConfig checkResources
  INFO: Undeploying context [/testprojekt]
  02.11.2009 13:21:35 org.apache.catalina.core.StandardContext resourcesStart
  SCHWERWIEGEND: Error starting static Resources
  java.lang.IllegalArgumentException: Document base /opt/tomcat6/webapps/testprojekt does not exist or is not a readable directory
          at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)
          at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4048)
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
          at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
          at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
          at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
          at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
          at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274)
          at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
          at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
          at java.lang.Thread.run(Thread.java:619)
  02.11.2009 13:21:35 org.apache.catalina.core.StandardContext start
  SCHWERWIEGEND: Error in resourceStart()
  02.11.2009 13:21:35 org.apache.catalina.core.StandardContext start
  SCHWERWIEGEND: Error getConfigured
  02.11.2009 13:21:35 org.apache.catalina.core.StandardContext start
  SCHWERWIEGEND: Context [/testprojekt] startup failed due to previous errors
  02.11.2009 13:21:35 org.apache.catalina.core.StandardContext stop
  INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/testprojekt] has not been started
  </code></pre>
  
  <p>Why is that? Is that the expected result? What is the right way to change parameters in a <code>context.xml</code>?</p>
  
  <p>Thank you in advance.
  Regards,</p>