Thursday, April 3, 2014

8:26 AM
Good day!

Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages, JavaServer Faces, Struts, and Spring technologies. The Java Servlet and JavaServer Pages specifications are developed under the Java Community Process.

This article describes the installation and usage of Apache Tomcat for Java web development. Tomcat version 8.x is used in this tutorial.

First thing we need to do is download apache tomcat type in the terminal shell:

$ wget http://www.gtlib.gatech.edu/pub/apache/tomcat/tomcat-8/v8.0.5/bin/apache-tomcat-8.0.5.tar.gz

After download extract it using:
$ tar -zxvf  apache-tomcat-8.0.5.tar.gz

Before starting the tomcat daemon, we have to configure the credentials used for managing the web server. In apache ver 8.x it can be found under the directory /conf/tomcat-users.xml

We will be adding default role name and username for the manager.

Under apache directory do:  $ vim /conf/tomcat-users.xml and add the following configurations. Here's what it looks like:

/conf/tomcat-users.xml



I added rolename for "manager-gui" and default username and password as "tomcat". Save it and proceed starting the daemon.

To start tomcat, cd into /bin under apache directory.

$ tree
.
├── bootstrap.jar
├── catalina.bat
├── catalina.sh
├── catalina-tasks.xml
├── commons-daemon.jar
├── commons-daemon-native.tar.gz
├── configtest.bat
├── configtest.sh
├── cpappend.bat
├── daemon.sh
├── digest.bat
├── digest.sh
├── setclasspath.bat
├── setclasspath.sh
├── shutdown.bat
├── shutdown.sh
├── startup.bat
├── startup.sh
├── tomcat-juli.jar
├── tomcat-native.tar.gz
├── tool-wrapper.bat
├── tool-wrapper.sh
├── version.bat
└── version.sh

Under Linux environment, you can do :

$ ./startup.sh  // to start the webserver
and
$ ./shutdown.sh // to stop the service.

By default, apache tomcat runs on port 8080 so you do http://localhost:8080 to validate if tomcat is successfully running.

If you click the "Manage App" you will be prompt for the login. Just enter your username and password you added in /conf/tomcat-users.xml
/conf/tomcat-users.xml

Congratulations! You have now apache tomcat running on your local machine.

0 comments:

Post a Comment