One important function of the Apache Tomcat manager web application is to undeploy web applications. In other words, the website will be removed from Tomcat and therefore no longer be available on the World Wide Web.
To learn how to undeploy web applications using the Apache Tomcat manager, follow these eight steps:
- Start the Tomcat server.
- You'll need to create a WAR file so that you'll have a sample website to undeploy. For instructions for creating and deploying a WAR file, click here. Follow all of the steps before proceeding to the next step here.
- You'll need to create credentials to access the Tomcat manager. For instructions for setting up a user name and password, click here. 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
c:/Tomcat8/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 website has now been removed from Tomcat. If you attempt to access the website through your browser, Tomcat will return a 404 HTTP status: