SWE 432 Installation Instructions for Tomcat

2/11/2004, update 10/27/2008


The ISE department provides a publically accessible web application server that supports servlets and JSPs, and I expect most of you to use apps-swe432 as your "target deployment computer". You can set up your own PC to support your servlets and JSPs at home. This will allow you to do most of your development and testing without having to go through GMU's computer systems. Please remember installing your servlets on apps-swer432 for grading is different and will take some time.

The following installation instructions will help you get and install Tomcat on your PC. Tomcat is the same servlet container that runs on apps-swe432.

  1. Download and Install Java Development Kit 1.5
    1. The apps-swe432 server uses Java SE 1.5, therefore you should use that version of Java. Download Java Standard Edition, v 1.5.0 (Java SE) from http://java.sun.com/javase/downloads/index_jdk5.jsp
      Select "JDK 5.0 Update 10"
    2. Install the JDK according to the instructions included with the release.
    3. Set the environment variable JAVA_HOME to the directory where you installed the JDK release.
      Start-> Setting-> Control Panel-> System-> Advanced-> Environment variables-> Go to system variable dialog-> Add new system variable (JAVA_HOME), variable value (drive:\yourjdkdirectory)
  2. apps-swe432 has Tomcat 5.5 installed, therefore it is reccomended that you use the same version. Download Tomcat "Core" zip file from: http://tomcat.apache.org/download-55.cgi
  3. Unzip apache-tomcat-5.5.20.zip.
    Assuming you unzipped it on drive C, the path is C:\apache-tomcat-5.5.20
  4. Startup Tomcat
    Execute the following commands from a command (DOS) window:
    C:\apache-tomcat-5.5.20\bin\
    startup
    After startup, the default web applications included with Tomcat 5.5 will be available by browsing http://localhost:8080/
  5. Deploy Servlet
    1. Go to c:\apache-tomcat-5.5.20\webapps
      You might need to create a project directory under webapps. Assume you give your project name as swe432:
      Directory Contains
      \swe432 This is the root directory of the web application. All JSP and XHTML files are stored here.
      \swe432\WEB-INF\classes This directory is where servlet and utility classes are located.
      \swe432\WEB-INF This directory contains all resources related to the application that are not in the document root of the application. This is where your web application deployment descriptor is located. Note that the WEB-INF directory is not part of the public document. No files contained in this directory can be served directly to a client.
      \swe432\WEB-INF\lib This directory contains Java Archive files that the web application depends upon. For example, this is where you would place a JAR file that contained a JDBC driver.
    2. Copy your class files to the classes directory. Note that when you replace a class in the classes directory, the files do not get reloaded dynamically. You must restart the server (shutdown tomcat, restart it again).
  6. Create a default web.xml file under \swe432\WEB-INF\
    Here is a sample web.xml file; this will allow you to access your servlets by using the /swe432/servlet/ path:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <!DOCTYPE web-app PUBLIC 
       "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
       "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
    
    <web-app>
                    
       <!-- Define servlets that are included in the example application -->
        <servlet>
          <servlet-name>invoker</servlet-name>
              <servlet-class>
    
                org.apache.catalina.servlets.InvokerServlet
              </servlet-class>
              <init-param>
                  <param-name>debug</param-name>
                  <param-value>0</param-value>
    
              </init-param>
              <load-on-startup>2</load-on-startup>
        </servlet>
            
         <servlet-mapping>
            <servlet-name>invoker</servlet-name>
    
            <url-pattern>/servlet/*</url-pattern>
        </servlet-mapping>
    </web-app>
    
  7. Access servlet by http://localhost:8080/ProjectRoot/ServletName/
    For example, http://localhost:8080/swe432/offutt.Hello
  8. Shutdown tomcat
    Execute the following shell commands:
    c:\apache-tomcat-5.5.20\bin\
    shutdown
  9. NOTE: When you make changes to your files, you will probably need to restart your server.`

Back to assignments page Back to schedule page