There are three administration tools bundled with Tomcat 5. They are:
Server Status application
Tomcat Administration Tool
These web applications are bundled with Tomcat by default and can be accessed from the left sidebar of Tomcat's default page. These tools address the need for simplified administration which other servlet engines, such as Websphere or Weblogic, provide.
The Administration Tool web application is the GUI tool for administering Tomcat. Before we can use it, or any of the GUI tools, we will first need to create a Tomcat administrator account, a Tomcat manager account and two roles: "admin" and "manager".
For this exercise, we will create one user "TomcatAdmin" who has both manager and admin privileges.
Table 5-1. Administration Users and Roles
|Tomcat Administrator Role||admin||This is a built-in role.|
|Tomcat Manager Role||manager||This is a built-in role.|
|Tomcat Administrator Username||TomcatAdmin|
|Tomcat Administrator Password||tcpass|
Launch your favorite editor and add the following lines in green to $CATALINA_HOME/conf/tomcat-users.xml.
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="tomcat"/> <role rolename="role1"/> <role rolename="manager"/> <role rolename="admin"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/> <user username="TomcatAdmin" password="tcpass" roles="admin,manager"/> </tomcat-users>
Save the file, start Tomcat and open a browser. You should be able to access the Administartion Tool web application by clicking on the "Tomcat Administration" link on the left sidebar. You will be presented with a login screen. Just type in your Tomcat Administrator username and password, and you should be able to enter the administration tool GUI. An example of this GUI is shown below. The Administration Tool has collapsible menus on the left. Click on any of the icons in the left pane to display information and settings in the right pane. Depending on the specifications of your server, the display of settings and information in the right pane can be very slow ! You have to be patient and restrain your urge to keep clicking if the system seems unresponsive.
Tomcat Administration Tool
You can access the Manager Web Application by clicking the "Tomcat Manager" link in the left sidebar of the default Tomcat page. This will display a GUI that allows you to view the status of your installed web applications and even deploy new web applications. There is also a link to the "HTML Manager Help" which can give you more information on using the Manager Web Application.
Tomcat Manager Web Application
The Manager web application also provides a way to install a new web application, reload it, start and stop it, and many other functions by merely passing a URL. For example, if we wanted to list the applications currently deployed in Tomcat, we could open a browser and key in http://hostname.domain.com:[port]/manager/list, and it will return the list that we require.
Finally, we have the Status web application, which displays the status of the Tomcat server, such as the memory utilization of the JVM, the version of JVM being run and the number and status of threads, among other parameters. This tool is new in Tomcat 5 and can be used to check if your Tomcat server is running low on system resources.
Status Web Application