The Jakarta Project
    Jakarta Tomcat Connector

Jakarta Tomcat Connector

Installation for Apache 2.0.x

Building mod_jk on Unix

The mod_jk build use the widely used configure system.

Prepare your mod_jk configure from CVS

In case you get source from CVS, ie without an existing configure script, you should have autoconf for configuration and installation. To create jakarta-tomcat-connectors's autoconf script, you will need libtool 1.3.3 or higher, and autoconf 2.13 or newer. Those tools will not be required if you are just using a package downloaded from apache.org, they are only required for developers.

To create the configure script just type :


[user@host] ~ $ ./buildconf.sh

Using configure to build mod_jk

The configure file produced using buildconf script will create all necesary make files. Here's how to use configure to prepare mod_jk for building, just type:


[user@host] ~ $ ./configure [autoconf arguments] [jakarta-tomcat-connectors arguments]

You could set CFLAGS and LDFLAGS to add some platform specifics:


[user@host] ~ $ LDFLAGS=-lc ./configure -with-apxs=/path-to-the-apache2-nstallation/bin/apxs

If you want to build mod_jk for 2.0, you should

  • use configure and indicate Apache 2.0 apxs location,
  • then make.

configure arguments

Apache related parameters :

ParameterDescription
--with-apxs[=FILE]

FILE is the location of the apxs tool. Default is finding apxs in PATH. It builds a shared Apache module. It detects automaticly the Apache version.

--with-apache=DIR

DIR is the path where apache sources are located. The apache sources should have been configured before configuring mod_jk. DIR is something like: /home/apache/apache_1.3.33 It builds a static Apache module.

--enable-maitainer-mode

Build mod_jk enabling maintainer or DEBUG mode.

JNI related parameters :

ParameterDescription
--enable-jni

Build the JNI worker and so the build process will require some informations about your Java Environment. Most of the options are autodetected.

--with-java-home=DIR

DIR is the patch to the JDK root directory. Something like: /opt/java/jdk12

--with-os-type=SUBDIR

SUBDIR is the os-type subdirectory, configure should guess it correctly.

--with-arch-type=SUBDIR

SUBDIR is the arch subdirectory, configure should guess it correctly.

--with-java-platform=VAL

VAL is the Java platform 1 is 1.1.x and 2 is for 1.2 anf higher, configure should guess it correctly.

Examples of configure use :

Apache 2.0 build
[user@host] ~ $ ./configure --with-apxs=/opt/apache2/bin/apxs
[user@host] ~ $ make
[user@host] ~ $ make install

Apache 2.0 build with JNI support
[user@host] ~ $ ./configure --with-apxs=/opt/apache2/bin/apxs \
--with-java-home=${JAVA_HOME} --with-java-platform=2 \
--enable-jni

Building mod_jk for Apache on Windows NT/2K/XP

The module was developed using Visual C++ version 6.0, so having this environment is a prerequisite if you want to perform a custom build.

The steps that you need to take are:

  • Change directory to the 2.0 source directory depending on your version of Apache.
  • If you want to build mod_jk for Apache 2.0, set an APACHE2_HOME environment variable which points to where your Apache 2.0 is installed.
  • You can use the free Microsoft tools for building mod_jk. You will need to download the Platform SDK and Microsoft Visual C++ Toolkit 2003 Ccopy the nmake.exe from PlatformSDK\bin\Win64 to PlatformSDK\bin.

    Apache 2.0 build on WIN32 using free VCToolkit
    c:\>C:\Vctoolkit\vcvars32.bat
    c:\>C:\PlatformSDK\setenv.bat
    c:\>nmake -f Makefile.vc

  • Copy mod_jk.so to Apache's modules directory.

An example on how to build mod_jk for Apache 2.0:

Set location for Apache 2.0 sources
c:\>set APACHE2_HOME=c:\apache20
Change directory to the mod_jk module for Apache 2.0
c:\>cd c:\home\apache\jk\native\apache-2.0
Build the sources using MSDEV
c:\>MSDEV mod_jk.dsp /MAKE ALL
Copy the dll to your apache modules directory
c:\>cp release\mod_jk.so c:\apache20\modules\

If msdev is not in your path, enter the full path to msdev.exe. Also, ApacheCore.lib is expected to exist in the ${APACHEX_HOME}\src\CoreD and ${APACHEX_HOME}\src\CoreR directories before linking will succeed. You will need to build enough of the Apache source to create these libraries. This will build both release and debug versions of the redirector plug-in (mod_jk). An alternative will be to open mod_jk.dsp in msdev and build it using the build menu.

Building mod_jk for Apache on iSeries/OS400

Since OS400 V4R5, iSeries (AS/400) has used Apache 2.0 as their primary web server, replacing the old IBM webserver. It's now possible to build mod_jk on iSeries thanks to the help of the IBM Rochester Labs which has provided information and patches to adapt mod_jk to OS400.

You should have at least Apache 2.0.39, a C Compiler and IFS. Apache 2.0.39 is provided with the most recent set of PTFs for the iSeries Apache server, which can be found at http://www.ibm.com/servers/eserver/iseries/software/http/

To configure mod_jk on iSeries use the CL source provided with the mod_jk source.

  • Get the latest mod_jk source and untar it on a Windows or Unix boxes
  • Create a directory in IFS, ie /home/apache
  • Send the whole jk source directory to iSeries directory via FTP.
  • Then go to the iSeries command line :

Create mod_jk library
===>CRTLIB MOD_JK TEXT('Apache mod_jk tomcat connector module')
Create service program source file
===>CRTSRCPF MOD_JK/QSRVSRC TEXT('Service program source file')
Create the CL build program source file
===>CRTSRCPF FILE(MOD_JK/QCLSRC) TEXT('Build program source file')
Edit the service program source file
===>STRSEU MOD_JK/QSRVSRC MOD_JK

In the edited file, specify that only jk_module should be exported :

Columns . . : 1 71 Edit MOD_JK/QSRVSRC
SEU==> MOD_JK
*************** Beginning of data *************************************
0001.00 STRPGMEXP PGMLVL(*CURRENT)
0002.00 EXPORT SYMBOL("jk_module")
0003.00 ENDPGMEXP
****************** End of data ****************************************

You could start to build all the modules of mod_jk :

Copy the CL build program source from IFS
===>CPYFRMSTMF FROMSTMF('/home/apache/jk/native/apache-2.0/bldjk.qclsrc') +
TOMBR('/QSYS.LIB/MOD_JK.LIB/QCLSRC.FILE/BLDJK.MBR') MBROPT(*REPLACE)
Build the CL build program
===>CRTCLPGM PGM(MOD_JK/BLDJK) SRCFILE(MOD_JK/QCLSRC) TEXT('Apache mod_jk build program')
Launch the build
===>CALL MOD_JK/BLDJK
If the build if successfull, copy the new mod_jk module
===>CRTDUPOBJ OBJ(MOD_JK) FROMLIB(MOD_JK) OBJTYPE(*SRVPGM) TOLIB(QHTTPSVR) NEWOBJ(MOD_JK)

Next, you should restart your Apache 2.0 server and enjoy this piece of OpenSource on iSeries.

Building mod_jk for Apache on MacOS/X

The configure file produced using buildconf script will create all necesary make files. The build process is the same as for Unix platforms. Here are the Mac OS X (10.2.x) build notes :

Assuming that you are root :

For Apache 2.0:
[user@host] ~ $ ./configure --with-apxs=/usr/local/apache2/bin/apxs
(you should point to the directory where you installed Apache 2.0)
[user@host] ~ $ cd apache-2.0
[user@host] ~ $ make -f Makefile.apxs
[user@host] ~ $ make -f Makefile.apxs install

Getting mod_jk linked statically with Apache

mod_jk allows to install mod_jk in the Apache source tree to get a statically linked mod_jk. Having mod_jk in the httpd executable brings some performance improvements. The configure option --with-apache prepare mod_jk to install it in the Apache source tree. The examples below show how to get mod_jk in the httpd process.

Installation in Apache-2.0 :

/home/apache20/httpd-2.0.52 is the directory where the httpd-2.0 sources are located.
[user@host] ~ $ ./configure --with-apache=/home/apache20/httpd-2.0.52
[user@host] ~ $ make
Install the mod_jk library and other files in /home/apache20/httpd-2.0.52/modules:
[user@host] ~ $ make install
It is not possible to configure Apache directly because the config.m4 of mod_jk must be added to the configure of httpd-2.0.
[user@host] ~ $ cd /home/apache20/httpd-2.0.52
[user@host] ~ $ sh buildconf
[user@host] ~ $ configure ... --with-mod_jk
[user@host] ~ $ make
[user@host] ~ $ make install

The enable-jk=share and enable-jk=static are not supported. --with-mod_jk only allow static linking of mod_jk.


Copyright © 1999-2004, Apache Software Foundation