Apache Software Foundation | Jakarta Project | Apache Tomcat
Intro

This document describes the configuration file used by mod_jk2 on the Tomcat site. Its default name is ${jkHome}/conf/jk2.properties, where ${jkHome} is the well known ${catalina.base} property.


Config options

Property name Default Description
handler.list request,container,channelSocket Handlers to load.
class.myhandler No default value Define the class of the handler myhandler.
apr APR descriptor
NativeSo jkjni Location of the jkjni dynamic library. It is searched in java.library.path but a absolute path can be specified.
jniModeSo inprocess If set to "inprocess" the jk2 will regiter native library functions by itself. If not then it has to be the absolute path of the jkjni dynamic library.
channelSocket A communication transport from a remote Web Server.
port 8009 First port where Tomcat is listening
address 127.0.0.1 Local address where Tomcat is listening.
maxPort port+10 Max port used to listen.
channelUnix A AF_UNIX socket communication transport from a local Web Server.
file No default value Name of the "file" associate with the socket. That must be absolut path name.
channelJni A in Web Server process communication.
mx mx4j adapter.
port -1 (Disabled) Port Number.
shm shared memory objects handler.
file /tmp/shm.file Shared memory file.
host localhost Host name.
port 8009 Port number.
unixSocket No default value Unix socket where tomcat is listening.


Examples

The examples below are working when the Web Server is configured according the examples described in the configweb file.

using normal socket

There is no need to use the jkjni logic to use normal socket, so that just for Fun.

# list of needed handlers.
handler.list=apr,channelSocket,request

# Override the default port for the channelSocket
channelSocket.port=8019

# Dynamic library
apr.NativeSo=/home1/jakarta/jakarta-tomcat-connectors/jk/build/jk2/apache2/jkjni.so


using AF_UNIX socket

Create and listen on a AF_UNIX socket. The location of the socket must be the same in the Web Server configuration file.

# list of needed handlers.
handler.list=apr,channelUnix,request

# Location of the socket.
channelUnix.file=${jkHome}/work/jk2.socket

# Dynamic library
jtc=/home1/jakarta/jakarta-tomcat-connectors
apr.NativeSo=${jtc}/jk/build/jk2/apache2/jkjni.so


using user defined class for communication

It is possible to have a user defined class for the communication. Here we have used the ChannelUn as example.

# Define our own handler.
class.mychannel=org.apache.jk.common.ChannelUn
# list of needed handlers.
handler.list=apr,mychannel,request

# Location of the socket.
channelUnix.file=${jkHome}/work/jk2.socket

# Dynamic library
jtc=/home1/jakarta/jakarta-tomcat-connectors
apr.NativeSo=${jtc}/jk/build/jk2/apache2/jkjni.so


using jni channel class for communication

Here we have the minimum configuration needed for the jni communication.

# list of needed handlers.
handler.list=apr,request,channelJni

# Dynamic library needs to be defined only if Tomcat is used
# out of process
jtc=/home1/jakarta/jakarta-tomcat-connectors
apr.NativeSo=${jtc}/jk/build/jk2/apache2/jkjni.so
# Or you can use the mod_jk2 directly
apr.jniModeSo=/opt/apache2/modules/mod_jk2.so

# If you wish to start the Tomcat from inside web server then
# you don't need any above directive. Here is shown the default
# value for the apr that you can ommit
apr.jniModeSo=inprocess