Friday, 10 January 2014

Accessing Tomcat Manager

If you deploy your web applications to Apache Tomcat, then you may want to know about accessing the Tomcat manager page.

Let's assume you already have downloaded Apache Tomcat. If not, please download the current stable version v7.x from the official download site.

Once you have downloaded Tomcat you have to set the environment variables.

Now in order to access the Tomcat Manager, go to the tomcat_home/conf directory { For instance /usr/temp/apache-tomcat-7.0.47/conf }.

Now edit the tomcat-users.xml file in Terminal. { vi tomcat-users.xml }. Scroll down and you'll observe the tags for roles and users.

Insert the following roles as follows :

  <role rolename="admin-gui"/>
  <role rolename="admin-script"/>
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-status"/>

Below the roles insert a new user named as 'admin' and define his roles in the following fashion :

<user username="admin" password="***" roles="admin-gui,manager-gui,manager-script"/>

Make sure to remove the comment tags <!-- and --> before roles and after the users block and save the file.

If you're not conversant with vi editor, I'll cover the topic about vi keyboard commands in another post.

For now, once the edits are made to the tomcat-users.xml, startup tomcat and open browser.

In the browser, type localhost:8080 { default port is 8080, but it can be modified if you want to. I'll cover this topic as well in a separate post. }. Then click the button Manager App on right. Check the below screenshot for reference.


Once you click Manager App, you'll prompted to enter the credentials. Enter the admin username and password which you specified in the tomcat-users.xml, to thereby access the manager. Here you can see the list of deployed applications. Individual applications can be started or stopped here. You can also check the server status here.


If you want to manually deploy a web application, you can choose the .war file and manually deploy it from this page. However, if you want to automate the deployment of a .war file using Apache Ant, I'll cover the topic in detail in another post. The post will contain information about copying the tomcat jars to ant home, defining tasks in build.xml to start, stop tomcat, deploy, undeploy an application. Stay tuned :)

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
eXTReMe Tracker