8.4.3. Customizing
Now follows the annoying part, the customizing of the config files. First edit
/usr/local/jakarta-tomcat-connectors-4.1.18-src/jk/conf/workers.properties,
and copy the file to /usr/local/apache/conf
I made a sample workers.properties that works with the example JSPs and servlets
that comes with the Tomcat distribution. It is based on the sample workers.properties from Tomcat
Example 8. workers.properties
workers.tomcat_home=/usr/local/jakarta-tomcat-4.1.18
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/lib/java2
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=/
# The workers that your plugins should create and work with
#
worker.list=worker1
#------ 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.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
#------ CLASSPATH DEFINITION -----------------------------------------
#---------------------------------------------------------------------
# Additional class path components.
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
# The JVM that we are about to use
#
# Unix - Sun VM or blackdown
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)classic$(ps)libjvm.so
# Setting the place for the stdout and stderr of tomcat
#
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr |
Next, you need to configure your apache config file httpd.conf.
The following example matches the examples provided by Tomcat.
LoadModule jk_module libexec/mod_jk.so
AddModule mod_jk.c
JkWorkersFile /usr/local/apache/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /examples/servlet/* worker1
JkMount /examples/*.jsp worker1 |
After restarting Apache, you should now be able to connect to your JSP's via Apache. I.e:
http://localhost/examples/jsp/num/numguess.jsp
For the further steps like installing your servlets and jsp-files, you are responsible by yourself...
| Environment Variables |
---|
| If Tomcat fails to start and/or your servlets could not be started the most common error made is having not
all needed classes in the CLASSPATH variable. |