You are on page 1of 13


Celsina Bignoli
History of Tomcat
Tomcat is the result of the integration of two groups of
JServ, an open source implementation of the Servlet
Suns own servlet engine.
The focus of the two groups was different:
JServ concentrated on performance
Suns implementation was more concerned with adherence to
Sun donated the code to Apache Software Foundation.
A group was formed named Jakarta - that was given a
charter of merging the implementations
Tomcat was born

Tomcat Requirements
Strict adherence to Suns JSP/Servlet
Server: Server represents the entire Tomcat server. One server per
Service: Service component creates the connectors and associates
the engine with this group of connectors.
Connector: Connectors are components that implement the socket
listeners. They connect web applications to clients. This component
provides flexibility to the Tomcat architecture. It allows the Tomcat
servlet engine to integrate with many different types of web servers
such as Apache, IIS etc.
Engine: Engine is the top level container. It examines the request
and routes the request to the appropriate virtual host.
Host: This allows multiple servers to be configured on the same
physical machine and be identified by separate IP addresses.
Context: This represents a single web application
Tomcat Installation and
Install JDK1.5
Download the Jakarta Tomcat software
Set the JAVA_HOME variable
Change port from 8080 to 80 (optional)
Set the CATALINA_HOME variable
Changing port to 80
configure Tomcat to run on the default HTTP port (80)
instead of the out-of-the-box port of 8080.
Making this change lets you use URLs of the form
http://localhost/blah instead of http://localhost:8080/blah
Some versions of Windows XP automatically start IIS on
port 80.
So, if you use XP you may need to disable IIS (see the
Administrative Tools section of the Control Panel).
To change the port, edit install_dir/conf/server.xml and
change the port attribute of the Connector element from
8080 to 80
<Connector port="80" ...
maxThreads="150" minSpareThreads="25" ...
Setting CATALINA_HOME Variable
set the CATALINA_HOME environment
variable to refer to the top-level directory
of the Apache Tomcat installation (e.g.,
This variable identifies the Tomcat
installation directory to the server.
Testing the Server
Involves two steps:
Verifying that the server can even start
Checking that you can access your own
HTML and JSP pages
use the default Web application.
put HTML and JSP pages in
install_dir/webapps/ROOT or
install_dir/webapps/ROOT/somePath and
access them with http://localhost/filename or
Setting the Development
Define a working directory in which to
place the servlets and JSP pages that you
The development directory should NOT
reside in the Tomcat deployment directory

Making Shortcuts
to Start and Stop the Server
place shortcuts to the server startup and
shutdown scripts inside the main
development directory or on the desktop.
Go to install_dir/bin, right-click on startup.bat,
and select Copy.
go to your development directory, right-click in
the window, and select Paste Shortcut (not
just Paste).
Repeat the process for
Since servlets and JSP are not part of the Java
2 platform, standard edition, you have to identify
the servlet classes to the compiler.
The server already knows about the servlet
classes, but the compiler (i.e., javac) you use for
development probably doesn't.
Include the following jar file in the CLASSPATH
Alternatively you can put the above jar files in
Compiling and Testing Simple
to verify the environment is all set compile and
run some simple Servlet, i.e.
the location for servlets in the default Web
application is:
Once you compile, put
HelloServlet.class in:
After compiling the code, access the servlet with
the URL: