2. Tomcat is a Servlet container (Web server that interacts with
Se rvle ts ) developed under the Jakarta Project of Apache Software
Foundation
Tomcat implements the Se rvle t and the Java Se rve r Pag e s (JSP)
specifications of Sun Microsystems
Tomcat is an open-source, non commercial project
◦ Licensed under the Apache Software License
Tomcat is written in Java (OS independent)
3. Tomcat is a free open source implementation of java server pages
and java servlets, developed as part of the Jakarta project
under the Apache Software Foundation
More info at:
http://tomcat.apache.org/
5. To use Tomcat web server working need to know about:
Environment variables
How to start and stop the server
How to configure Tomcat to pick up web files from your directory
6. Extract source zip file into a directory on hard disk. Default directory
is jakarta-tomcat-ve rsio n#.
A set of subdirectories are automatically created (bin, conf, doc etc)
Tomcat uses two environment variables:
environment variables:
◦ JAVA_HOME and CATALINA_HOME
7. Extract source zip file into a directory on hard disk. Default directory
is jakarta-tomcat-ve rsio n#.
A set of subdirectories are automatically created (bin, conf, doc etc)
Tomcat uses two environment variables:
environment variables:
◦ JAVA_HOME (point to directory containing JDK)
◦ CATALINA_HOME (point to directory containing Tomcat)
8. From UNIX shell prompt, go to where Tomcat is installed
◦ dgomaa_debian: cd /usr/local/jakarta-tomcat-1.6…
Go to the subdirectory bin
To START:
◦ ./startup.sh
Tomcat server executes on TCP port 8080 (in case another
server is using the default port 80)
9. To test Tomcat, in browser type URL:
http://hostname:8080/
This will access the Tomcat documentation welcome page if
server working properly
To STOP Tomcat when it is running
◦ ./shutdown .sh
10. By default, Tomcat looks in its own WEBAPPS directory for web
application files (e.g. jsps, html etc)
To hold application files elsewhere, need to edit the se rve r. xm l
configuration file (in the conf directory) to look in alternate location.
Both <host> and <context> element need to be changed -
NOTE: Always make a backup of server.xml before changing!
In server.xml:
change Host name parameter appbase from ‘webapps’ to the
preferred directory you want
<Host name="localhost"debug="0"
appBase=“/home/dgomaa/tomcat-apps/webapps" reloadable =
"true"
11. To set up an application directory: -
To create a new web application (e.g. newapp) in your
web application directory Tomcat directory :
◦ create a subdirectory of your WEBAPPs directory in which to hold
the web application files
◦ This directory is now the top level directory for the web application
newapp, accessed as
http://www.domainname/newapp
12. An application's directory must contain the following:
◦ The directory WEB-INF/
◦ A legal web.xml file under WEB-INF/
<web-app>
</web-app>
14. Environment variable java_home incorrect
Not putting 8080 in URL (http://localhost:8080)
Not configuring server.xml to look at correct location of your web
files
Not starting the server…
Not re-starting the server when you’ve added/ changed your files
Not re-setting the environment variables when shell re-started