The Wiki will be unavailable from 7am until 9am on Tuesday, 28 November, 2017, due to server and database patching.
Skip to end of metadata
Go to start of metadata

Standard context config

In Tomcat 5.x+ it's no longer recommended to add web application descriptions to server.xml.

Instead, the <Context> element and its contents should be added to the /META-INF/context.xml.

The value of the @path attribute on the <Context> element is no longer used. Even if it exists in the file, it is ignored.

Instead, the name of the application folder, or the name of the .war file is used as the path for application deployment. i.e. if you deploy an application called "mygreatapp.war", it will be deployed to /mygreatapp

Deploy an app to a custom URL

In order to deploy an application to a URL other than that of its name, you must rename the /META-INF/context.xml file before deployment. For example, if you want to deploy mygreatapp.war to /myapps/greatness/ you would rename context.xml to myapps#greatness.xml.

Thus, the name of the context file reflects the required deployment path, with forward slashes replaced by the hash sign.

However if you're using the name of the context file to specify your deployment path you may no longer use the standard Ant tasks for application deployment. Instead, you must follow the rules listed in the Introduction in the Tomcat context config documentation. In practice this means copying your webapp to a folder outside of the Tomcat "webapps" folder (e.g. the w3b4pp5 dir) and placing your context file in a particular location.

On the dev server this location is /opt/www/tomcat-instances/dev/conf/dev/dev.bath.ac.uk and the locations are similar for the other Tomcat Instances.

At the time of writing we don't have a method of automating this, but we should be able to do so using the Ant scp task

  • No labels