The Jakarta Project
The mighty Tomcat - Meow!

Tomcat on NetWare HowTo

By Mike Anderson mmanders@novell.com

This document explains how to setup Tomcat 4 to run on NetWare. Sections are provided for running Tomcat standalone, running with the NetWare Enterprise Web Server, and running with Apache on NetWare.

Table of Contents

Document Conventions and Assumptions

<catalina_home> is the root directory of Tomcat 4. By default this is at the root of the SYS: volume (SYS:\jakarta-tomcat-4.0.2 by default for Tomcat 4.0.2) but it can be placed anywhere, on any volume.  Your installation should have the following sub-directories:
  1. <catalina_home>\conf - Where you can place various configuration files
  2. <catalina_home>\webapps - Contains example applications and is the default place for adding your applications
  3. <catalina_home>\bin - Where you place web server connectors and startup scripts
In all the examples in this document, <catalina_home> will be SYS:\jakarta-tomcat-4.0.2.

A worker is the tomcat process that accepts work from the web server.

Tested Configurations

Tomcat 4 and the web server connectors described here have been tested on:
  1. NetWare 6 with the 1.3 JVM.
The connectors have been tested with the ajp13 worker. 

Installation

Builds of Tomcat 4 are available as binary distributions and the web server connectors for NetWare are available in the bin/netware/i386 directory.  The mod_jk.nlm file is the connector for Apache, and the nsapi_rd.nlm file is the connector for the NetWare Enterprise Web Server.  Once you have downloaded the appropriate zip file and unzipped it to your NetWare server, you can run Tomcat 4 in standalone mode.  To run with another web server providing static content, you will need to configure the web server appropriately and copy the necessary connector(s) to the appropriate directories.
 

Running Tomcat Standalone

To run Tomcat standalone, it is easiest to create an NCF file to start Tomcat. A sample CATALINA.NCF could look like this:

; This is a sample NCF file for starting TOMCAT 4 on NetWare. The
; CATALINA_HOME and CATALINA_BASE environment variables should be modified
; to reflect the directory where you actually install Tomcat 4

envset CATALINA_HOME=SYS:\jakarta-tomcat-4.0.2

envset CATALINA_BASE=SYS:\jakarta-tomcat-4.0.2

envset CATALINA_CLASSPATH=$CATALINA_HOME\bin\bootstrap.jar
envset CATALINA_CLASSPATH=$CATALINA_CLASSPATH;sys:\java\lib\tools.jar

; The following command line starts Tomcat 4 with it's own Console Screen
; that will automatically close (-nsac) with the screen called Catalina
; (-snCatalina) and the current working directory set  to CATALINA_HOME
; (-envCWD=$CATALINA_HOME)
java -nsac -snCatalina -envCWD=$CATALINA_HOME -classpath $CATALINA_CLASSPATH -Dcatalina.base=$CATALINA_BASE -Dcatalina.home=$CATALINA_HOME org.apache.catalina.startup.Bootstrap %1 %2 %3 %3 %5 %6 %7 %8 %9

As the comment states, you will need to make sure that CATALINA_HOME points to the correct directory.

By putting this NCF file in SYS:\System you can start Tomcat 4 by just typing catalina start at the system console. You can also add this to your autoexec.ncf to automatically start Tomcat when your system comes up. The %1 ... %9 at the end of the command line allows you also pass in additional parameters to Tomcat.  Try catalina help to see a base list of parameters available.
 

Running Tomcat Behind a Web Server

To run Tomcat behind a web server, you need to provide some configuration information to tell the web server how to communicate with Tomcat.   This configuration is typically in a file called workers.properties that is created in the <catalina_home>/conf directory.  This file is referenced by the web server plugins and a simple workers.properties follows:

# workers.properties -
#
# This file provides jk derived plugins with the needed information to
# connect to the different tomcat workers.

#
#------ worker list ------------------------------------------
#---------------------------------------------------------------------
#
#
# The worker(s) that your plugins should create and work with. Defaults to an
# ajp13 worker
#
worker.list=ajp13

#
#------ DEFAULT ajp13 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#

#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

Running Tomcat with the NetWare Enterprise Web Server

To run Tomcat with the NetWare Enterprise Web Server, you need to download nsapi_rd.nlm and copy it to your NetWare server. A good location is <catalina_home>\bin\netscape\netware\i386. You will then need to add the following to your obj.conf file located in SYS:\novonyx\suitespot\https-<servername>\config. This will tell the NetWare Enterprise Web Server to let Tomcat handle the /examples/* URIs. 
NOTE: the workers.properties referenced needs to be created since a default one isn't included in the Tomcat 4 distribution. A sample workers.properties is shown in Running Tomcat Behind a Web Server
  1. In the Init section add the following 2 lines (if you see more than 2 lines, your browser is wrapping the lines):

  2. Init fn="load-modules" funcs="jk_init,jk_service" shlib="sys:/jakarta-tomcat-4.0.2/bin/netscape/netware/i386/nsapi_rd.nlm"
    Init fn="jk_init" worker_file="sys:/jakarta-tomcat-4.0.2/conf/workers.properties" log_level="debug" log_file="sys:/jakarta-tomcat-4.0.2/logs/nsapi.log"

  3. In the default object NameTrans section add the following line:

  4. NameTrans fn="assign-name" from="/examples/*" name="Catalina"

  5. Create a new configuration object by adding the following 4 lines to the end of the obj.conf file:

  6. <Object name="Catalina">
    ObjectType fn="force-type" type="text/plain"
    Service fn="jk_service" worker="ajp13"
    </Object>
Now stop and restart the NetWare Enterprise Web Server, make sure that Tomcat is running (i.e. run the catalina.ncf file mentioned in Running Tomcat Standalone) and you should be able to access http://server:port/examples/

Running Tomcat with Apache on NetWare

To run Tomcat with Apache on NetWare, you need to download mod_jk.nlm and copy it to your NetWare server.  A good location is the modules directory under your Apache installation.  You can then add the following directives to your httpd.conf file to access examples from Tomcat via the web server.
NOTE: the workers.properties referenced needs to be created since a default one isn't included in the Tomcat 4 distribution. A sample workers.properties is shown in Running Tomcat Behind a Web Server

#
# The following line instructs Apache to load the jk module
#
LoadModule jk_module modules/mod_jk.nlm

JkWorkersFile "SYS:/jakarta-tomcat-4.0.2/conf/workers.properties"
JkLogFile "SYS:/jakarta-tomcat-4.0.2/logs/mod_jk.log"

#
# Log level to be used by mod_jk
#
JkLogLevel error

#########################################################
# Apache configuration for the /examples context starts.
#########################################################

#
# The following line makes apache aware of the location of the /examples context
#
Alias /examples "sys:/jakarta-tomcat-4.0.2/webapps/examples"
<Directory "sys:/jakarta-tomcat-4.0.2/webapps/examples">
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
</Directory>

# The following lines mount all the servlets and jsps for the examples
# context
#
JkMount /examples/servlet/* ajp13
JkMount /examples/*.jsp ajp13

#
# The following line prohibits users from directly accessing WEB-INF
#
<Location "/examples/WEB-INF/">
    AllowOverride None
    deny from all
</Location>
#
# Use Directory too. Location doesn't work unless case matches
#
<Directory "sys:/jakarta-tomcat-4.0.2/webapps/examples/WEB-INF/">
    AllowOverride None
    deny from all
</Directory>