Wednesday, February 22, 2012

How to install & troubleshoot Apache Tomcat ( NetBeans and IDEA ) - Part 01

Posted by sudheera On 10:36 AM

What is Tomcat ?
Tomcat is an open source servlet container and web server for java servlets and Java Server Pages(JSPs).

Installation guide for windows

1. Get tomcat
First you have to download the Binary Distribution from the apache website. Latest release is 7.0.25 But I would recommend 6.0.35 stable version. For windows download the appropriate bit distribution suit for your system.(32 bit or 64 bit)


Once you downloaded the binary distribution you can extract it and copy to a folder. I would recommend C:/Program Files.

Important : Your system should have installed netbeans 6.0(with web and Java EE) or higher and JDK latest version.

2. Configure
First we have to configure tomcat users and roles by editing  tomcat-users.xml located in the conf folder. (C:\Program Files\apache-tomcat-6.0.35\conf) 

Initially it would look look like this 

(click on the image to zoom)

Now you have to edit the tomcat-users.xml file as you wish.Ultimately it should look like following.

<?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
        <role rolename="manager"/>
        <role rolename="standard"/>
        <user username="admin" password="pwd" roles="standard,manager"/>
     </tomcat-users>
 
You can download the edited  tomcat-users.xml file (with above username and password ) here
Later you will need this username and password when adding server to netbeans.

3. Adding External Server

Then you have to add the server to netbeans. Start up netbeans as the first step.
Then find the service tab on the left hand side. If you can't find the services tab there, just hit Ctrl+5 or goto Windows->Services

Right click on Servers and click 'add server'


Then you will get 'Add server instance' window choose the appropriate server and hit next

In next window you have to specify the sever location. That is the extracted folder which is located inside program files folder. And you need to enter the username and password you added to the tomcat-users.xml file.

 
With that step you are done with installation. Good luck with your work. My next post is about some difficulties which I faced during installing tomcat. Thank you.