Some of the novice users reported that they are having problems when they try to configure Apache Tomcat in their Linux system. Since Tomcat 6 is available in the repository of most of the popular distributions, installing the piece of software is not a difficult thing.
But the initial configuration of the software has be done manually. This edition of techblog explains how to do the initial configuration of your newly installed Tomcat server.
Setting up
After installing Tomcat, make sure that the service is running in the 8080 port. If it is not running, issue (as root):
/etc/init.d/tomcat6 start
And then go to
http://localhost:8080/
Two important information that you need to configure the server are CATALINA_BASE and CATALINA_HOME. In my case, CATALINA_BASE is located in /usr/share/tomcat6. This location may change depending on the distribution that you are using. The best way to get this information is by looking at the home page (localhost:8080) of the running Tomcat service. In that page, you can find details concerning your CATALINA_BASE and CATALINA_HOME.
CATALINA_BASE and CATALINA_HOME are two parameters required if you want to start the service from another application (say from an IDE like Netbeans).
Now go to the tomcat directory (/etc/tomat6) and locate the ‘tomcat-users.xml’ file under the ‘conf’ directory. Open this file in your favourite text editor. And you can find few entries in that file:
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="tomcat"/> <role rolename="role1"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/> </tomcat-users>
Add few more entries for the roles ‘manager’, ‘admin’ and usernames ‘manager’ and ‘admin’:
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="tomcat"/> <role rolename="manager"/> <role rolename="admin"/> <role rolename="role1"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="manager" password="your_password" roles="manager"/> <user username="admin" password="your_password" roles="admin,manager"/> <user username="role1" password="tomcat" roles="role1"/> <user username="both" password="tomcat" roles="tomcat,role1"/> </tomcat-users>
Most of the users will forget to add the ‘admin’ role which is also required to configure the server. Now you can go to
http://localhost:8080/manager/html
And login using your username and password (for manager)
You may have a glance at this document file for more information:
http://localhost:8080/docs/manager-howto.html
Tomcat manager allows you to configure all the applications that are using Tomcat as the service. It also helps you to deploy the applications in the server, after development. You may individually stop or restart a particular application using this interface.
You can access the Admin interface by going to the following URL:
http://localhost:8080/admin/
This interface allows you to add or edit new users (you don’t have to use the user.xml for doing this), groups (which is one of the features which most of the users forget to configure) and roles. You can also configure the data sources and environment parameters for the server.
This is very handy if you are running a webhosting service, as this gives you power to suspend ‘managers’ who misuse the server resources. Since you can easily manage the Data sources, this tool is very useful even if you are running the service in localhost.
The only issue with Tomcat is that since it being a light weight one, it is not recommended if you want to deploy a large number of complex applications. In this case, Glassfish will be a better choice.




Join Techblog
Facebook Group
Read
Digg entries
Add techblog to
Google reader