\”The Entity Bean is on vacation.\”

March 17, 2006

HOW-TO : Installing Apache Tomcat 5.5

Filed under: How-Tos, Tomcat — Gautam Satpathy @ 10:51 pm

Apache Tomcat is probably the best J2EE server to use for learning and as a testbed. It is small, fast, robust and most importantly easy to manage. I have used Tomcat since the 3.0 days and thought I would share a few things as a set of How-Tos/Tutorials/Notes.

Tomcat has now matured and moved out of the Jakarta umbrella. It has it’s own project web site at http://tomcat.apache.org. At this writing the last milestone release of the Tomcat 5.5.x series is 5.5.16. We will use this version as our base for this discussion.

Downloading & Installation:

The first thing to do is to download Tomcat. Tomcat binaries come in a number of packaging flavors The Windows Installer package is the most convenient You will find the download page links on the Tomcat home page. You will also need the 1.5 JDK from Sun.

To install Tomcat, execute the downloaded file. I suggest you pick the Full option in the Choose Components installer screen. This will dump everything, including examples and sample web applications.

Tomcat Installation - Choose Components

Figure 1. Tomcat Installation – Choose Components

The installer will now prompt you for the disk location. I suggest you select something simpler than the default (C:\Program Files\Apache Software Foundation\Tomcat 5.5). D:\Tomcat5.5 will do just fine and will be easier to handle latter when we write ANT scripts to manage Tomcat and deploy web apps into it.

Tomcat Installation - Choose Install Location

Figure 2. Tomcat Installation – Choose Install Location

On the next screen you need to provide some configuration information. Note that these are important. You should make a note of what you enter here. However, do note that all of these can be changed later by modifying the Tomcat configuration files.

Tomcat Installation - Configuration

Figure 3. Tomcat Installation – Configuration

The last step before the installation starts is to specify the JDK Tomcat will use. NOTE: It is very important that you specify a JDK installation and NOT a JRE installation in this step. Tomcat will not work with a JRE. It needs access to the compilation and other tools that are available only in the JDK. Most probably the installer will pick your JRE installation. Remember to change it to your JDK installation. Also note that you will need JDK 1.5.

Tomcat Installation - JVM Selection

Figure 4. Tomcat Installation – JVM Selection

Now you are ready to complete the installation. Click the Install button to start.

During the installation, the Tomcat Windows Service will be installed. We will come back to that in a little while. After the installation you will get the following top level forder structure.

Tomcat 5.5 Folder Structure.

Figure 5. Tomcat 5.5 Folder Structure.

This structure looks similar to the Tomcat 4.x structure but there are many differences deeper down. A lot of things have been simplified.

Note that you will have to keep stopping and restarting your Tomcat server many times during the day. This means the Tomcat Windows Service is more of a pain than help. I suggest you change the service setting to Manual from the default Automatic Startup Type.

Tomcat Windows Service Properties

Figure 6. Tomcat Windows Service Properties

Tomcat 5.5 has another neat feature. A Tray server monitor program!

Tomcat Monitor Tray Icon

Figure 7. Tomcat Monitor Tray Icon

Tomcat Monitor Popup Menu

Figure 8. Tomcat Monitor Popup Menu

You can control the Tomcat service from the Configure menu item. This brings up the Apache Tomcat Propertes Screen in which you can control a whole host of stuff like the service startup type, Log level & folder, the JVM, classpath & Java command line options, startup & shutdown settings.

Tomcat Configuration Screen

Figure 9. Tomcat Configuration Screen

As you can see, changing the startup type to Manual actually helps us. We have this nifty little server monitor program that runs in the tray. As a result starting & stopping the server is a snap!

Running for the First Time:

Now it is time to fire up Tomcat for the first time. Use the Tomcat Monitor to start the server instance. Then use your favorite browser (Firefox of course!) and point it to http://localhost:9000/.Change the port to whatever you spcified above. You should see the page in the screen shot below:

Tomcat Default Page

Figure 10. Tomcat Default Page

Congratulations! You now have a working Tomcat 5.5 installation!

Play around with the various examples etc. We will cover Tomcat Server Configuration, Administration and Management next.

NEXT : Tomcat Configuration (Server.xml, Contexts & Logging)

Another Struts Link

Filed under: General, J2EE — Gautam Satpathy @ 7:00 pm

What is Struts – An article by Chuck Cavaness from OnJava.com – Slightly dated but good nontheless. A all-in-one printable page version of this article.

Struts – A Few Links

Filed under: General, J2EE — Gautam Satpathy @ 6:34 pm

This post contains a few Struts related links. Keep checking back for updates.

That’s it for now. Will add more recommendations as time permits.

Create a free website or blog at WordPress.com.