installing tomcat in 15 minutes (cookbook approach for windows)

Warning: many pages on this wiki imply that a servlet container must be installed before running Cocoon, this is wrong - see NoServletContainerRequired. A basic installation of Cocoon for test or development purposes can be very simple.

What you will get from this page

You will learn, how to retrieve and setup tomcat, the official reference ServletContainer. This approach has been tested with tomcat 4.1.18 and newer releases.

Your basic skills

I assume, you

have minimal knowledge about webapplications and application servers in general.

Step I: Get the distrib

On the distribution directory you will find several tomcat packages suitable for different operating systems. You would retrieve the .exe version, which comes along with a nice and easy to use install shield. If you want to use winzip, you also can download the zip distribution.

caveat: Make shure, which java version you have installed. If you are running the Java-1.4 runtime or JDK, please retrieve one of the tomcat distributions, which are clearly labeled with jdk14. If you are running a lower version of java, you must download one of the other distributions. You can check from a DOS-Box which java version you are running by issuing the following command:

java -version

Step II: Unpack it (if you use the zip-distrib)

NOTE: To avoid errors, make sure that there are no spaces in the path name if you want to use JSP.

unpack the zip-distribution

unpack the distrib to any convenient place. You should use the convention to unpack under the folder

c:\programs\tomcat

install the installshield based exe-version

you may simply call this exe file now. An installer will open up. You may complete the installing process with the given defaults. At the end your tomcat server is ready to operate and you can start it from the start menu

Start -> Programs -> Apache Tomcat 4.* -> Start Tomcat

You are ready with the installation. You may continue at the paragraph "startup Tomcat for the forst time"

Step III: Prepare for startup (only zip-distrib)

Once you have installed tomcat, you need to prepare it for startup. I recommend to try first starting the distribution as is. You only need to modify something, if the following ports are already occupied by some other program:

Please note, that your tomcat server comes with an included http-server. So you don't need a webserver like the apache-server to run your servlets. You simply start tomcat, then you are ready to access it from your browser.

modify the standard port settings

As pointed out above, you need to do this only, if you are shure, that the Tomcat standard ports are already occupied. If you are unshure, just start Tomcat and check for errors telling about "Adress already bound"-messages. If this occurs, come here and do the following:

Enter the subfolder named "conf"

edit the file named server.xml

Search for the shutdown port definition

<Server port="8005" shutdown="SHUTDOWN" debug="0">

You may change the port to any convenient number above 1024 and below 32768.

Depending on your system, either the Coyote/JK2 AJP Connector, the AJP 1.3 Connector is active. The inactive connector is commented out with XML comments of following syntax:

<!-- anything except 2 consecutive '-' signs -->

You may inactivate both connectors for the moment, but need to reactivate one as soon as you want to connect your Webserver with tomcat.

Start your container for the first time

installed exe-version:

from the start menu

Start -> Programs -> Apache Tomcat 4.* -> Start Tomcat

zip-distribution:

Enter the subfolder named "c:\programs\tomcat\bin" of your distribution. You will find a set of usefull batch files:

||catalina.bat || best for manual startup from commandline ||startup.bat || best for script based startup ||shutdown.bat || best for script based shutdown

You may use catalina.bat for the beginning:

cd C:\ptograms\tomcat\jakarta-tomcat-4.1.16\bin
./catalina.bat

You have started tomcat now in foreground. The shell is blocked and tomcat runs. You can stop tomcat by pressing CTRL-C at any time.

An alternative way is to use ./startup.bat instead of ./catalina.bat This would start tomcat in the background sending the screen output into a logfile instead. To stop tomcat in background mode, use the batch file shutdown.bat

Verify operation

Once you have started tomcat, you can use your Browser to access the Welcome page. Assuming you have not modified the server.xml as described above, you may now access Tomcat by typing in your browser:

http://localhost:8080

You might have to replace localhost by the name of your server if your browser runs on a different machine. If you see the Tomcat welcome message, chances are very high, that your installation was correct. If you don't see anything see below.

Where to go next

Now you have managed to install the Tomcat Servlet Container. You have verified, that your container operates in your environment. Now it's time to get cocoon into play. I propose following documents: