IBM Support

How to build Tomcat plug-in mod_jk on IBM i

News


Abstract

This article discusses how to how to get the latest Open Source mod_jk version source code, compile, and build it on IBM i server in order to associate Tomcat with an HTTP Server on IBM i. The original Tomcat IBM i plug-in, QZTCJK.SRVPGM, is based on an old mod_jk version. IBM does not currently support the Tomcat IBM i plug-in and no longer ships (IBM i 7.5 and later) or provides updates to the QHTTPSVR/QZTCJK.SRVPGM object. As a result, Tomcat IBM i plug-in users are now required to download, compile, and build their own MOD_JK.SRVPGM as discussed in the instructions below.

Please NOTE: This article is provided "as-is". No support from IBM is available through SWMA to assist or obtain guidance with this process.

This article introduces how to compile, build, and use the latest version of open source Tomcat plug-in mod_jk on IBM i 7.2 and above.

Content

Support
The steps below are provided "as-is".  No support from IBM is available through SWMA to assist or obtain guidance with this process.  The Apache Tomcat product as well as this mod_jk plugin are Open Source products, not covered by SWMA.  Please refer to the Open Source Support for IBM i for more information on how to obtain support with this process.

Steps
Below steps show how to get the latest version mod_jk source code and compile, build it on IBM i 7.2 and above server.

Step 1, Download mod_jk source code

Download the latest version source code (JK 1.2.50 Source Release tar.gz) from Apache Tomcat website http://tomcat.apache.org/download-connectors.cgi and the current latest version is JK 1.2.48.

Step 2, FTP the source code to IBM i

FTP the source code package to IBM i server and unzip it to an IFS directory: /home/apache/jk like below structure:

image 12411

Step 3, Update the build file for IBM 7.2 and later

We need to copy the new build file bldjkibmi.qclsrc(attached below) to /home/apache/jk/native/apache-2.0 directory due to the large file support feature is enabled by HTTP Server on IBM i 7.2 and later.

Note:  If you exact your source code to other directories in step 1, you also need to update the build file accordingly to change the path of source code.

Step 4, Apply code patch

There is a flaw in the source code of tomcat-connectors v1.2.39 and later, which needs to be fixed in order to get the mod_jk successfully complied and build on IBM i(See the bottom of the patch).  

If we use the default source code to compile and build mod_jk, HTTP Server fails to start with below errors in job logon IBM i.

 MCH3601 Escape 40 07/17/14 21:51:39.069163 QZSRAPR QHTTPSVR *STMT QZSRAPR QHTTPSVR *STMT

                                      From module . . . . . . . . :   APR_POOLS                                                     

                                      From procedure  . . . . . . :   allocator_free    

                                      Statement . . . . . . . . . :   8                                                             

                                      To module . . . . . . . . . :   APR_POOLS                                                    

                                      To procedure  . . . . . . . :   allocator_free                                                

                                      Statement . . . . . . . . . :   8                                                            

                                      Message . . . . :   Pointer not set for location referenced.                                  

                                      Cause . . . . . :   A pointer was used, either directly or as a basing 

The patch also includes a fix for this. Apply the patch jk_connect.patch (attached below) before compiling the source code.

Step 5, Create mod_jk library

 CRTLIB MOD_JK TEXT('Apache mod jk Tomcat connector module')

Step 6, Create service program source file

CRTSRCPF MOD_JK/QSRVSRC TEXT('Service program source file')

Step 7, Create the CL build program source file

CRTSRCPF FILE(MOD_JK/QCLSRC) TEXT('Build program source file')

Step 8, Edit the service program source file

STRSEU MOD_JK/QSRVSRC MOD_JK

SEU==>

*************** Beginning of data *************************************

               STRPGMEXP PGMLVL(*CURRENT)

               EXPORT SYMBOL("jk_module")

               ENDPGMEXP

****************** End of data ****************************************

Step 9, Copy the CL build program source for IBM i from IFS

CPYFRMSTMF FROMSTMF('/home/apache/jk/native/apache-2.0/bldjkibmi.qclsrc') TOMBR('/QSYS.LIB/MOD_JK.LIB/QCLSRC.FILE/BLDJKIBMI.MBR') MBROPT(*REPLACE)

Step 10, Build the CL build program for IBM i

CRTCLPGM PGM(MOD_JK/BLDJKIBMI) SRCFILE(MOD_JK/QCLSRC) TEXT('Apache mod_jk build program') TGTRLS(*CURRENT)

Step 11, Launch the build for IBM i

CALL MOD_JK/BLDJKIBMI

Step 12, Copy mod_jk to QHTTPSVR library and grant correct authority

If the mod_jk is successfully built in step 11,  optionally, we can copy it to HTTP Server library QHTTPSVR and grant correct authority so it can be loaded by HTTP Server for i.

CRTDUPOBJ OBJ(MOD_JK) FROMLIB(MOD_JK) OBJTYPE(*SRVPGM) TOLIB(QHTTPSVR) NEWOBJ(MOD_JK)

Change the object authority of /QSYS.LIB/QHTTPSVR.LIB/MOD_JK.SRVPGM like below:

image 12418

Step 13,  Start HTTP Server to test

Follow the previous article to install Tomcat and setup HTTP Server on i, the only change is using the new built Tomcat plug-in LoadModule jk_module /QSYS.LIB/QHTTPSVR.LIB/MOD_JK.SRVPGM to replace the old IBM Tomcat plug-in LoadModule jk_module /QSYS.LIB/QHTTPSVR.LIB/QZTCJK.SRVPGM in the httpd.conf.

Start HTTP Server and access Tomcat home page to test. In the jk.log, you can see the new built Tomcat plug-in is loaded:

[info] mod_jk.c (3383): mod_jk/1.2.48 initialized 

Resources

[1] http://tomcat.apache.org/download-connectors.cgi

Attachment

bldjkibmi.qclsrc.txt

jk_connect.patch.txt

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CGqAAM","label":"IBM i HTTP Server"}],"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.2.0;7.3.0;7.4.0;7.5.0;7.6.0"}]

Document Information

Modified date:
22 July 2025

UID

ibm16520356