• google plus

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:

  1. Start the Tomcat server.
  2. 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.
  3. 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.
  4. In the address area of your browser, type http://localhost:8080/manager/html and submit that address to the browser.
  5. 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):
    Manager credentials
    Click OK
  6. The manager web page contains a list of the deployed web applications:
    Manager list deployed apps for undeploy
    Note that each application, including DemoWebsite has 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 CATALINA_BASE/conf/Catalina/host_name, e.g., /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.
  7. Click the undeploy button associated with DemoWebsite. The manager will respond indicating the web application has been undeployed:
    Manager undeployed message
  8. 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:
    Manager DemoWebsite HTTP 404
Author: Stephen Withrow

Stephen has over 30 years' experience in training, development, and consulting in a variety of technology areas including Java, C, C++, XML, JavaScript, AJAX, Tomcat, JBoss, Oracle, and DB2. His background includes design and implementation of business solutions on client/server, Web, and enterprise platforms. Stephen is a published writer in both technical and non-technical endeavors. Stephen received an undergraduate degree in Computer Science and Physics from Florida State University.

About Webucator

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, Azure, Windows, Java, Adobe, Python, SQL, JavaScript, Angular and much more. Check out our complete course catalog.