How to Undeploy Web Applications Using the Apache Tomcat Manager (Linux)
One important function of the Apache Tomcat manager web application is to undeploy web applications. In other words, the web site will be removed from Tomcat and therefore will no longer be available on the World Wide Web.
To learn how to undeploy web applications using the Apache Tomcat manager in Linux, follow these 8 steps:
- Start the Tomcat server.
- You'll need to create a WAR file so that you'll have a sample web site to undeploy. The instructions for creating and deploying a WAR file can be found in the topic . Follow all of the steps in this topic before proceeding to the next step.
- You'll need to create credentials to access the Tomcat manager. The instructions for setting up a user name and password were contained in Steps 2, 3, and 4 in the topic . You will need to restart the Tomcat server after completing the steps in that topic.
- In the address area of your browser, type
http://localhost:8080/manager/htmland submit that address to the browser.
- You will be challenged for credentials. Provide the user name and password you specified in
tomcat-users.xml(make sure to provide the correct spelling and case):
- The manager web page contains a list of the deployed web applications:
Note that each application, including
DemoWebsitehas an associated set of buttons that allows you to start, stop, reload and undeploy the web application. We will focus our attention now on the undeploy operation. Undeploy will delete the WAR file and unpacked folder under the "webapps" folder (note: if you have deployed the web application as a context file then the context file will be deleted from
/var/lib/tomcat7/conf/Catalina/localhost). **IMPORTANT: Before you undeploy your website, make sure you have a backup of the WAR file (or context file) in case you need to deploy the web application in the future.
- Click the
undeploybutton associated with
DemoWebsite. The manager will respond indicating the web application has been undeployed:
- The web site has now been removed from Tomcat. If you attempt to access the website through your browser, Tomcat will return a 404 HTTP status: