How to load/reload/unload apps while Tomcat is running

To manage web applications with Tomcat, you can use the Tomcat manager application that comes with Tomcat. These simple steps show how it is done:

  • Make sure that there is a user with manager role set up in the .../tomcat4/conf/tomcat-users.xml file. The line to define the user should look like this:
    <user username="manager" password="md5hash-goes-here" roles="admin,manager">
  • If you changed the file above, restart tomcat, for your changes to take effect.
  • Now you are ready to use the Tomcat manager webapp to load / reload / unload webapps from your tomcat container.
  • Refer to the tomcat manager webapp documentation for all the details. Here are a couple of examples:
    • To list the loaded apps, and their status:
      
      http://localhost:[port]/manager/list
    • To reload an app (“[port]” is your HTTP connector port in the server.xml file, and “[webapp-path]” is the path as displayed with the “list” comand):
      
      http://localhost:[port]/manager/reload?path=/[webapp-path]
  • Since the HTTP connector is usually not available from outside the firewall, you will probably do that from the command line, in which case, the most effective way is to use “curl” eg:
    curl -u [admin_user]:[secret_passwd]
    
    http://localhost:[port]/manager/reload?path=/[webapp-path]
This entry was posted in Java and tagged . Bookmark the permalink.

NewPush has solutions to fit your business needs.  For more than a decade, our focus has been to take on the technical challenges that are the hardest and most time-consumming.  Our goal is to free up your resources to focus on the core activities of your business and to drive your business performance.  Please visit our main site at newpush.com for more information or call us at +1-303-423-4500.