Tomcat on FC4

These are some working notes on the configuration of Apache Tomcat on Fedora Core 4.

WAR deployment

The MKSearch Web Application Archive (WAR) is normally output in the $mk_home/dist directory. To deploy the WAR in Tomcat, it must be copied to the Web application directory at /var/lib/tomcat5/webapps. Since this application directory is owned by the root user, you must use the su command, as below.

$ su
Password:

# cp $mk_home/dist/mksearch.war /var/lib/tomcat5/webapps

# exit

$

If you have previously deployed the MKSearch application, you will be prompted to overwrite the existing WAR file. Just type y and press Enter.

When you start the Tomcat service with its default configuration, the container will expand the MKSearch application to the directory /var/lib/tomcat5/webapps /mksearch. You should be able to access the query interface at http://localhost:8080/mksearch/

If you have previously deployed the MKSearch WAR, you will need to remove the application directory, as below. You must stop the Tomcat service before you delete the application.

$ su
Password:

# rm -rf /var/lib/tomcat5/webapps/mksearch

# exit

$

Standard service start-up

The Tomcat 5 installation that is packaged with Fedora Core 4 should work with a default configuration.

  1. In graphical mode, open the system go to the Desktop application menu, then go: System Settings > Server Settings > Services.
  2. Enter the root user's password when prompted.
  3. Scroll down the alphabetical list of installed services and select tomcat5
  4. Click the Start button on the main toolbar, or the right-click context menu. You should get confirmation that the service started.
  5. To check Tomcat is running, open a Web browser and check the local host on port 8080: http://localhost:8080/.

    Service shut-down

    To manually shut down Tomcat, repeat as above, but choose the Stop option from the toolbar or context menu. After several seconds' delay, you should get confirmation the service stopped successfully.

    Automatic service management

    To automatically start and stop Tomcat when the system boots, check the box next to the tomcat5 service entry in the Services applet.

Application structure

/usr/share/tomcat5

This is the path that the environment variable CATALINA_HOME refers to, which is normally the primary installation directory. On Fedora Core 4, most of the directories it contains are symbolic links to other locations, as follows:

common  -> /var/lib/tomcat5/common
conf    -> /etc/tomcat5
logs    -> /var/log/tomcat5
server  -> /var/lib/tomcat5/server
shared  -> /var/lib/tomcat5/shared
temp    -> /var/cache/tomcat5/temp
webapps -> /var/lib/tomcat5/webapps
work    -> /var/cache/tomcat5/work
/etc/tomcat5

This is the location of the Tomcat server configuration, including server.xml. On Fedora Core 4, it also contains a tomcat5.conf file that configures the service under which Tomcat runs.

/usr/bin/tomcat5 script

This is a short bash script that calls the Apache startup/shutdown script, dtomcat5.

/usr/bin/dtomcat5 script

An adapted version of the Apache Tomcat startup/shutdown script, with hard coded references to use the configuration at /etc/tomcat5/tomcat5.conf and use the PID file at /var/run/tomcat5.pid. This script is called directly by the Fedora process manager via /etc/rc.d/init.d

/var/lib/tomcat5/webapps

This directory contains the example applications distributed with Tomcat, which can be used to test the successful installation of the container. The tomcat-docs directory holds the system and source documentation.

/var/lib/tomcat5/common

The classes in this common library path are available to all applications and the Tomcat container itself.

The classes subdirectory is empty, endorsed has symbolic links to the JAXP parser implementation and Apache Commons APIs packaged with Fedora Core 4.

The lib directory contains the fundamental supporting classes for the Tomcat system itself, including the Servlet API, the Jasper Java Server Pages (JSP) compiler and runtime, plus JavaMail providers and object pooling systems.
/var/lib/tomcat5/shared

This shared path contains resource that are available to all Web applications but not the Tomcat container itself and its subdirectories are empty.

/var/lib/tomcat5/server

This directory contains the "Catalina" system classes, in the lib subdirectory. The classes subdirectory is actually empty, and the webapps has restricted access; it contains the admin and manager applications.

/var/run/tomcat5.pid
The process identifier for Tomcat.
/usr/share/tomcat5/bin/relink script
This is a script that refreshes the symbolic links for the Tomcat shared libraries before the server is started.
This document was last modified on 2005-10-13 09:51:27.
Copyright MKDoc Ltd. and others.
The Free Documentation License http://www.gnu.org/copyleft/fdl.html