Wednesday, August 6, 2014

Starting with tomcat setup

Let's start with  the tomcat setup where I did following:

DOWNLOAD:
Downloaded tomcat from  http://tomcat.apache.org/.
I downloaded the version 8 that was the latest version

INSTALL:
Get the zip directory and unzip it into some folder like C:\folder1\folder2\tomcat8
After unzip, move to the bin directory and run the startup.bat and access http://localhost:8080 to make sure that you see that tomcat welcome page. It means things are moving in the right direction.

SYSTEM VARIABLES
Set the system variable  - CATALINA_HOME to C:\folder1\folder2\tomcat8
Go to cmd and type echo %CATALINA_HOME% to see it emitting the correct folder that you have specified, it will confirm that the env variable has set correctly.
Now go to the system variable PATH and add - %CATALINA_HOME%\bin
Go back and do windows+R and type startup.bat, it should start the tomcat server.
Access the page http://localhost:8080 to make sure that you see that tomcat welcome page. It means things are moving in the right direction.

HOSTING
Go to your %CATALINA_HOME%\webapps\ROOT folder and create test.html page
Access this page by http://localhost:8080.test.html to make sure that you see your test page. It means things are moving in the right direction.

Server Status
On the welcome page, clicking on server status will ask you for the credentials. There are no default credentials, go to %CATALINA_HOME%\conf\tomcat-users.xml and edit it in a editor. Add the following line in the last:

<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>

save it and restart the tomcat. Now using the tomcat/tomcat credentials you should be able to access the page. Roles and their meanings are as below:
  • manager-gui — Access to the HTML interface.
  • manager-status — Access to the "Server Status" page only.
  • manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the "Server Status" page.
  • manager-jmx — Access to JMX proxy interface and to the "Server Status" page.

Configure Tomcat Ports
The most common hiccup is when another web server (or any process for that matter) has laid claim to port 8080.  This is the default HTTP port that Tomcat attempts to bind to at startup.  To change this, open the file:

       $CATALINA_HOME/conf/server.xml

    and search for '8080'.  Change it to a port that isn't in use, and is     greater than 1024, as ports less than or equal to 1024 require superuser access to bind under UNIX.

    Restart Tomcat and you're in business.  Be sure that you replace the "8080" in the URL you're using to access Tomcat.  For example, if you change the port to 1977, you would request the URL http://localhost:1977/ in your browser.



No comments:

Post a Comment