Search code examples
javatomcatwebdeploy

Context file not loading tomcat


I created a dynamic web project and added a context.xml file to the META-INF folder as mentioned here. But when I deploy the war file the context file is not copying to the folder $CATALINA_BASE/conf/[enginename]/[hostname]/. My context.xml file content are following,

<?xml version='1.0' encoding='utf-8'?>
<Context>    
    <Environment name="test" value="10"
         type="java.lang.Integer" override="false"/> 
</Context>

Why this approach is not working? How can I set the context of a application dynamically?


Solution

  • Try updating the Host element inside your tag.

    <Engine name="Catalina" defaultHost="localhost">
          <Realm className="org.apache.catalina.realm.LockOutRealm">
            ...
          </Realm>
    
          <Host name="localhost"  appBase="webapps"
                unpackWARs="true" autoDeploy="true" copyXML="true">