Setting up Tomcat Web Application Manager
The Tomcat Web Application Manager provides many capabilities to help manage your Web applications. It allows you to deploy and "undeploy" Web applications in multiple ways, list applications, reload them, and even stop and start them.
To implement Tomcat Web Application Manager, you must first grant access to a specific user in the tomcat-users.xml file. To do so, use the code in Listing 9.
Listing 9. Grant access to Tomcat Web Application Manager by adding a user and role
vi tomcat-users.xml Add these two lines below in between the two <tomcat-users> tags <tomcat-users> <role rolename="manager"/> <user username="tomcat1" password="test1234" roles="manager"/> </tomcat-users>
Just in case you're wondering, the above user and password are completely arbitrary. You do not need to create that user with the password on your UNIX server and can set these to whatever you wish. You will, however, use that information to log in to the management console.
For additional security, limit the access to that tomcat-users.xml file to only the owner of the file. To do so, you must set the permissions at 700 or below—for example:
# chmod 600 tomcat-users.xml
For the changes above to take effect, you must restart your Tomcat server. To do so, use the code in Listing 10.
Listing 10. Restart your Tomcat server
cd $CATALINA_HOME/bin ./shutdown.sh ./startup.sh ;tail -f ../logs/catalina.out
You should see something similar to this when you tail your catalina.out log file:
May 15, 2008 4:08:12 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/74 config=null May 15, 2008 4:08:12 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 6271 ms
Go back to your Tomcat management console. Click the Tomcat Manager link in the Administration section of the left navigation pane. When successful, you will see the a window similar to Figure 4.
Figure 4. Tomcat Web Application Manager startup page
Tomcat also has a status application, which displays the status of the Tomcat server, including memory utilization of the JVM and the number of threads. You can access this very useful tool by clicking Server Status at the top right-hand side of the Tomcat Web Application Manger.