When we copy a WAR file to the application base directory of Apache Tomcat, we usually expect the web application to be deployed. In other words, we expect the website to be immediately available on the World Wide Web. However, this doesn't always have to be the case. The
autoDeply attribute on the
Host element determines if the web application will be available for access on the internet.
To learn how to use the
autoDeploy attribute in Apache Tomcat, follow these two steps:
- Open a text editor session on
- Locate the
Hostelement using your editor's search facility. The entry will look similar to the following:Note that the
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
autoDeplyattribute is set to
true. As you would imagine, this setting indicates that a WAR file or a context file that is copied to Tomcat will be made available for processing. This is to say, the web application will be deployed. If you set the value to
falseand then restart the Tomcat server, the web applications will not be deployed. In order to deploy the web applications so that the outside world can use them, you will have to use either the Tomcat manager web application or JMX beans.