Copyright  2001-2007 Nicholas Quaine.
Home   Basics   ServerSide   ClientSide   Demos   FAQ   Resources
ServerSide
1. Overview
2. Deploying Tomcat
3. Deploying SOAP
4. Deploying Services
Packages
Version Details
Sun Java
Tomcat
Apache SOAP
JavaMail
JAF
Xerces

Prev   1    2    3    4    Next
Server-Side SOAP
2. Deploying Tomcat

Steps one to three cover the deployment of the Tomcat Application Server. These instructions are applicable to both Win32 and UNIX operating systems - take care to follow the instructions appropriate to your operating system in sections where differences exist.


STEP ONE Download and install Java



  • If you already have java version 1.3.0 or later installed on your machine then you can skip this step. You can verify your java version with the following command:
      > java -fullversion
    
    The result of this command should be something like the following (if you see a version number of 1.3.0 or later then you are OK and can skip to the next bullet point):
      java full version "1.3.1_01"
    
    If you have a version prior to 1.3 or if java is not installed at all (i.e. when you typed the above command, "java" could not be found at all) then you can download Java 1.3 free of charge from Sun Microsystems. Go to http://java.sun.com/j2se/1.3/, choose the download section relevant to your operating system, in the section entitled "Download Java 2 SDK, v 1.3.x Software..." hit CONTINUE, read and ACCEPT the agreement (if you are happy with the terms) then choose the appropriate site for FTP download. Save the file to your machine. This is a self-extracting executable. Run it to install the package.

    If you have a version prior to 1.3 and for whatever reason do not want to install 1.3 (even though two Java SDK versions can, in general, be installed in parallel without danger) then feel free to proceed anyway though we cannot guarantee that the tutorial will work for you. Some prior versions will work though it is not our intention to test them all and provide a compatibility list.

  • Set your java home environment variable "JAVA_HOME". Set this to the root directory of your JDK installation (ie. the parent of the bin directory where your java.exe is found). Keep this command in a script file (call the file anything you like but I'll refer to this as mystartup.bat on Win32 or mystartup.sh on UNIX). We will be adding more things to it later so as to avoid having to type the same commands over and over again.

    Win32 Systems
    If the fully qualified path of your java.exe is C:\jdk1.3.1\bin\java.exe then for the moment the script looks like this:
    Win32 script : mystartup.bat
    
      set JAVA_HOME=C:\jdk1.3.1
    

    UNIX Systems
    If the fully qualified path of your java binary is /usr/java then for the moment the script looks like this:
    UNIX script : mystartup.sh
    
      #!/bin/sh
      JAVA_HOME=/usr/java
      export JAVA_HOME
    


STEP TWO Download and install Tomcat



  • Create a soap directory on your machine. We will be using C:\soap on Win32 and /home/me/soap on UNIX but you can name it anything and put it anywhere you like. Just ensure that you replace your chosenpath and directory name for C:\soap or /home/me/soap (as applicable) wherever you see it below.
    Warning : White-space in the directory names of any directory in the path will cause you pain later on so this should be avoided from the outset.
  • Go to http://jakarta.apache.org/tomcat/index.html and download Tomcat (choose Download/Binaries then Release-Builds/Tomcat-3.2.x (where x is the latest subversion of 3.2) then choose "jakarta-tomcat-3.2.x.zip" for Win32 or "jakarta-tomcat-3.2.x.tar.gz" for UNIX and save it to your machine).
    Warning : When you read 3.2.x in the following text and scripts, do not take it literally - replace the x with the 3.2 subversion number of the package you have downloaded.
  • Unpack to the soap directory. Everything will be contained in a subdirectory named jakarta-tomcat-3.2.x. Ensure that within jakarta-tomcat-3.2.x there is a lib directory and it contains 6 jar files - these are the jar files that contain the Tomcat classes themselves plus all required libraries.

STEP THREE Startup Tomcat and verify that it is operating correctly



  • Firstly, note that complete instructions and documentation on how Tomcat works and what it does are available at http://jakarta.apache.org/tomcat/tomcat-3.2-doc/index.html.
  • We will make use of the startup script "startup.bat" (Win32) / "startup.sh" (UNIX) provided by Apache to startup the Tomcat server. But we first need to set the tomcat home environment variable TOMCAT_HOME. Add the new lines (shown in bold) to your startup script such that it looks like the following:
    Win32 script : mystartup.bat
    
      set JAVA_HOME=C:\jdk1.3.1
      set TOMCAT_HOME=C:\soap\jakarta-tomcat-3.2.x
      %TOMCAT_HOME%\bin\startup.bat
    
    UNIX script : mystartup.sh
    
      #!/bin/sh
      JAVA_HOME=/usr/java
      export JAVA_HOME
      TOMCAT_HOME=/home/me/soap/jakarta-tomcat-3.2.x
      export TOMCAT_HOME
      $TOMCAT_HOME/bin/startup.bat
    
  • Startup Tomcat by executing the script (Note that on UNIX systems you may need to "chmod 755" the scripts $TOMCAT_HOME/bin/startup.sh and $TOMCAT_HOME/bin/tomcat.sh before being able to execute them). You should see output something like the following (the order of the messages may vary but the PoolTcpConnector lines should always appear last):
      2001-07-04 01:32:17 - ContextManager: Adding context Ctx( /examples )
      2001-07-04 01:32:17 - ContextManager: Adding context Ctx( /admin )
      Starting tomcat. Check logs/tomcat.log for error messages
      2001-07-04 01:32:22 - ContextManager: Adding context Ctx( /test )
      2001-07-04 01:32:25 - ContextManager: Adding context Ctx(  )
      2001-07-04 01:32:28 - PoolTcpConnector: Starting HttpConnectionHandler on 8080
      2001-07-04 01:32:28 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007
    
  • Your Tomcat server is now running and listening for requests on port 8080. You can test this by pointing a browser to http://localhost:8080. You should see the Tomcat welcome page with a brown cat and a Tomcat version number in the top left corner.
  • Test that JSPs are working correctly by running one of the JSP examples (for instance you can choose JSP Examples, then Numberguess/execute and try to guess the number that has been randomly selected. If things are not working it will be fairly obvious - in that case you must have done something wrong - go back to step one and try again).
  • Test that servlets are working correctly by running one of the servlet examples (for instance you can choose Servlet Examples, then Hello World/execute - if you see the "Hello World!" message then everything is working fine).

You now have the Tomcat application server up and running. The following section teaches you how to deploy the Apache SOAP Webapp to your Tomcat server.

[ Nicholas Quaine ]

Next

Copyright 2001-2007 Nicholas Quaine. All rights reserved.