Welcome to Srini's blog

Wednesday, February 10, 2010

Tomcat manager web application

Enable tomcat manager web application
If you install tomcat6.x (Download)version properly then you may find 'manager' dir in tomcatserver/webapps. You can try to connect manager web application using following url in any standard browser . http://{Ip}:{port}/manager/list. Here Ip is Machine IP of tomcat server running and port is In which port tomcat running by default it is 8080. By hitting this url you will get current running applications.
After hitting this url in browser it will prompt for user name and pwd. Actual discussion starts here. If you want to use tomcat manager web application there are some pre-requisites.
1. Need tomcat useraccount.
2. This user account should be under manager role.
How to do this is mentioned below.
Go to 'tomcatserver/conf' dir and open 'tomcat-users.xml' file and edit file as
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager"/>
</tomcat-users>.

3.Save it and restart tomcat server. Now try the url and give the creds.


Monitoring Tomcat Performance
You can monitor tomcat server Ability, Load, Memory Utilization, CPU Utilization. try the following URL http://{server}:{port}/manager/status?XML=true. you will get response as a XML it contains high-level memory statistics: free, total, and max memory. it will be useful for monitoring tomcat.

Note : We can launch tomcat manager web application without creds also .. But this is not recommended for production env. please follow below steps.
1. Go to tomcatserver/manager/WEB-INF.
2. Edit the web.xml file as without 'auth-constraint'. Search for 'auth-constraint' tag and just comment out the statements under this tag(including this tag). No need to restart tomcat server. Now hit the url http://{server}:{port}/manager/status?XML=true.

Good luck...

1 comment:

  1. I have 2 updates to this post.
    1. One of my colleague asked me If we allow tomcat manager without credentials then there should be some means to restrict access. Yes We can restrict IPs to access this manager application. Add the following context to 'server.xml'.

    <Context path="/manager">
    <Valve className="org.apache.catalina.valves.RemoteHostValve" allow="172\.29\.223\.1"/> .

    2. If you didn't found 'manager' folder in tomcat webapps dir then download it from tomcat site and place it.

    Thanks,
    Srini.T

    ReplyDelete