Tuesday, July 3, 2012

Apache Tomcat 7 | How to Install & Configure |


This tutorial can be completed in a 3-hour session, with guidance from instructor.
This installation and configuration guide is applicable to Tomcat 7, as well as the earlier versions.

Introduction

Introduction to Web Applications and HTTP

web application, unlike standalone application, runs over the Internet. Examples of web applications are google, amazon, ebay, among others. A web application is a 3-tier (or multi-tierclient-server application, usually involving a database. Most of the web applications run on the HTTP application protocol, with browser as the client to access an HTTP server.
A web database application requires five components, as illustrated below:
  1. HTTP Server: E.g., Apache HTTP Server, Microsoft IIS, Apache Tomcat, and etc.
  2. HTTP Client (Browser): E.g., MSIE, FireFox, Chrome, and etc.
  3. Database: E.g., MySQL, Oracle, DB2, Infomix, MS SQL Server, MS Access, and etc.
  4. Client-Side Programs: could be written in HTML Form, JavaScript, VBScript, Flash, and etc.
  5. Server-Side Programs: could be written in Java Servlet/JSP, ASP, PHP, and etc.


A user, via a web browser, issue a URL to an HTTP server to start a web application. The web application first downloads a client-side program (such as an HTML form) into the browser. The user fills up the query criteria in the form. The client-side program sends the query parameters to a server-side program, which queries the database and returns the query result to the client. The client-side program displays the result on the browser.
HTTP is an asynchronous request-response application-layer protocol. A client sends a request message to the server. The server returns a response message to the client. The syntax of the message is defined in the HTTP specification.




Introduction to Apache Tomcat

Apache Tomcat is a Java-capable HTTP server, which could execute Java programs. It is the official Reference Implementation (RI) for Java Servlets and JavaServer Pages (JSP) technologies. Tomcat is an open-source project, under the "Apache Software Foundation" (which also provides the famous open-source industrial-strength Apache HTTP Server). The mother site for Tomcat is http://tomcat.apache.org. Alternatively, you can find tomcat via the Apache mother site @ http://www.apache.org.

How to Install Tomcat 7 

STEP 0: Read the Tomcat Documentation

Tomcat's documentation is available at Tomcat mother site @ http://tomcat.apache.org. Select "Documentation" ⇒ "Tomcat 7.0".

STEP 1: Download Tomcat

  1. From http://tomcat.apache.org ⇒ Select "Downloads" ⇒ "Tomcat 7.0" ⇒ "7.0.xx" ⇒ "Binary Distributions" ⇒ "Core" ⇒ "zip" ⇒ "apache-tomcat-7.0.xx.zip".
  2. UNZIP into a directory of your choice. DO NOT unzip onto the Desktop (because its path is hard to locate). I suggest using "d:\myproject". Tomcat will be unzipped into directory "d:\myproject\apache-tomcat-7.0.xx". For ease of use, we shall shorten and rename this directory to "d:\myproject\tomcat". Take note of Your Tomcat Installed Directory. Hereafter, I shall refer to the Tomcat installed directory as <TOMCAT_HOME>.
I recommend "zip" version, as you could simply delete the entire directory when Tomcat is no longer needed (without running any un-installer). You are free to move or rename the Tomcat's installed directory. You can install (unzip) multiple copies of Tomcat in the same machine.