How to Deploy a Web Application Using the Apache Tomcat Manager (Windows)

See Apache: Tips and Tricks for similar articles.
Looking to improve your Windows skills? Check out Webucator’s Windows classes.

To deploy a web application to Apache Tomcat, you can copy a WAR file to the application base directory, e.g., c:/Tomcat8/webapps. This operation of course presupposes we know the application base directory. We could consult server.xml and look up the Host element to determine the directory name. A more straightforward approach, though, is to use the Tomcat manager web application.

To learn how to deploy a web application using the Apache Tomcat manager web application, follow these 12 steps:

  1. Stop the Tomcat server.
  2. You will need to edit CATALINA_BASE/conf/tomcat-users.xml, e.g., c:/Tomcat8/conf/tomcat-users.xml to add credentials to access the Tomcat manager web application.
  3. Add the following XML statements immediately before the root end tag, i.e., </tomcat-users>:
    <role rolename="manager-gui"/>
    <user username="your name" password="your password" roles="manager-gui"/>
    &lt/tomcat-users>
    	
    Replace "your name" and "your password" with a user name and password of your choosing (no embedded spaces).
  4. Save your changes.
  5. You'll need to create a WAR file so that you will have web application to deploy. The instructions for creating a WAR file were contained in steps 1 and 2 in How to deploy a WAR file in Apache Tomcat (Windows). Complete only steps 1 and 2. If you have already completed that project, delete the WAR file (DemoWebsite.war) and the unpacked folder (DemoWebsite) from CATALINA_HOME/webapps.
  6. Start the Tomcat server.
  7. In the address area of your browser, type http://localhost:8080/manager/html and submit that address to the browser.
  8. 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
  9. The manager web page is now displayed. Scroll down until you see the Deploy section: Manager deploy Note that I have already provided the Context Path (/DemoWebsite) and the WAR URL ((c:/DemoWebsite/DemoWebsite.war) in the text boxes. Fill in the text boxes as I've done. Then click Deploy.
  10. The manager will indicate that the web site has been deployed: Manager web app deployed
  11. In a separate tab in your browser, type http://localhost:8080/DemoWebsite/DateJSP.jsp and submit that address to the browser.
  12. The web page will be displayed verifying successful deployment: Demo Website

Related Articles

  1. How to Start and Stop Apache Tomcat from the Command Line (Windows)
  2. How to Deploy a WAR File to Apache Tomcat (Windows)
  3. How to Start and Stop Apache Tomcat from the Command Line (Linux)
  4. How to Deploy a WAR File to Apache Tomcat (Linux)
  5. How to Run a JSP Program in Apache Tomcat (Windows)
  6. How to Check the Status of the Apache Tomcat Server (Windows)
  7. How to Deploy a Web Application Using the Apache Tomcat Manager (Windows) (this article)
  8. How to Check the Status of the Apache Tomcat Server (Linux)
  9. How to Set Default Context Path in Apache Tomcat (Windows)
  10. How to Use the autoDeploy Attribute in Apache Tomcat (Windows)
  11. How to Deploy a Web Application Using the Apache Tomcat Manager (Linux)
  12. How to List Deployed Applications Using the Apache Tomcat Manager (Windows)
  13. How to Run Multiple Instances of Apache Tomcat on One Server (Windows)
  14. How to Run a JSP Program in Apache Tomcat (Linux)
  15. How to Establish a JDBC Connection in Apache Tomcat (Windows)
  16. How to Verify Apache Tomcat Server Operation (Windows)
  17. How to Cluster in Apache Tomcat (Linux)
  18. How to Undeploy Web Applications Using the Apache Tomcat Manager (Windows)
  19. How to Set Default Context Path in Apache Tomcat (Linux)
  20. How to Use the Java Logging API in Apache Tomcat (Windows)
  21. How to Cluster in Apache Tomcat (Windows)
  22. How to Use the Java Logging API in Apache Tomcat (Linux)
  23. How to Use the autoDeploy Attribute in Apache Tomcat (Linux)
  24. How to Configure Apache Tomcat to Use MBeans (Windows)
  25. How to List Deployed Applications Using the Apache Tomcat Manager (Linux)
  26. How to Install and Configure Apache Tomcat (Windows)
  27. How to Configure Apache Tomcat to Use MBeans (Linux)