1
votes

My context.xml (in META_INF) folder looks like this:

<?xml version="1.0" encoding="UTF-8"?>


<Context path="MY_CONTEXT_NAME" docBase="${catalina.home}/webapps/MY_APP_NAME"
        debug="0" privileged="true">

</Context>

The problem is, context.xml is getting copied to the CATALINA_HOME> conf>Catalina>localhost folder when I deploy my application war via tomcat manager. However, it is somehow still deploying from default context, that is , app_war_name.

Earlier, it was not even getting copied to localhost folder, I removed the default context.xml form tomcat 6.0>conf folder. After that, the file is at least getting copied. However, the deployment is not happening from the explicit context.xml.

My server.xml host entry looks like this :

  <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="false"
            xmlValidation="false" xmlNamespaceAware="false" >
  </Host> 
2
You have a spelling error autoDeploy="fasle" instead of autoDeploy="false"Paulino III
Sorry for the typo, but correcting the typo did not help. I think, that might have happened while trying to make it work by marking it true then again back to false...it does not help but :( I tried to check various other links here.. but not sure whats wrong I am doing...Kislay Kishore

2 Answers

0
votes

Read the documentation for the path element of the Context element. It states quite clearly

This attribute must only be used when statically defining a Context in server.xml. In all other circumstances, the path will be inferred from the filenames used for either the .xml context file or the docBase.

Even when statically defining a Context in server.xml, this attribute must not be set unless either the docBase is not located under the Host's appBase or both deployOnStartup and autoDeploy are false. If this rule is not followed, double deployment is likely to result.

Then read the documentation for the docBase element.

The value of this field must not be set unless the Context element is defined in server.xml or the docBase is not located under the Host's appBase.

0
votes

if you deploy again with new context or changed context you need to un-deploy first/ or remove context.xml from conf/.../localhost/yourapp.xml