Install and Configure Tomcat

Introduction

Apache Tomcat is an open source web server and Java Servlet container.  It supports HTML (with CSS and Javascript), jsp (Java Servlet Pages), and most Java-based server technologies, such as Jersey.

Install Tomcat

  1. Install a Java Development Kit.  See Install and Configure Eclipse for Java EE Development
  2. Browse to Apache Tomcat Downloads
  3. In the Binary Distribution section, click on 32-bit/64-bit Windows Service Installer (the exe; not the zip)
    1.  Note: I suppose you could download the zip file instead, if you didn’t want to run a server on your PC.  I haven’t had much luck with that option.
  4. Verify the integrity of the download.  TODO Add instructions. I haven’t done this lately.
  5. Run the downloaded installer, using Run As Administrator
  6. Accept the defaults until you get to the Configuration page
  7. On the Configuration page, choose a Tomcat Administrator Login user name and password.  You’ll use this login later to deploy projects to this server.
  8. Continue to accept defaults through the rest of the setup.
  9. Test the running server by browsing to http://localhost:8080
  10. The browser should show a Tomcat “Hello” page.
    1. If it doesn’t, the server might not be running.  See To Start or Stop the Server, below, to start it.
    2. If it still doesn’t show the hello page, you’ll need to debug the problem. Another server may be already running on port 8080; the Java or Tomcat configuration may be incorrect.
  11. On that Tomcat main page, click the Manager App button
  12. Login using the user name and password you created earlier
  13. You should then see the Tomcat Web Application Manager
  14. You can now close your browser.
  15. Add a Windows Environment Variable named CATALINA_HOME, set to the root folder of your tomcat installation.  Something like C:\Program Files\Apache Software Foundation\Tomcat 8.0
  16. Whenever you want to do Eclipse-based web development, you must first stop this server (see the instructions below).  If you don’t, you’ll have two Tomcat servers attempting to listen to the same port – which won’t work well.

To Stop or Start the Server (Windows)

  1. Click the Windows Start button
  2. Type View Local Services
  3. In the resulting window, click on the line labeled Apache Tomcat
  4. Stop or start the server by clicking the links on the left labeled Stop the service or Start the service

To Add a Project .war file to your server

Tomcat projects are packaged in .war (Web ARchive) format. To add a given .war file to your server:

  1. TODO add instructions once you have it working.  Deployment is pretty easy, but I ran into some problem of running the deployed war file.