Appendix C. Building mod_jk2 on Red Hat Enterprise Linux 3 (RHEL) [Contributed by Andrew Clute]

Note

This solution was contributed by Andrew Clute. The actual text of the email has been adapted for instructions.

These steps apply to a stock RHEL install and mod_jk2 version 2.0.4. Please refer to the chapter on "Integrating Tomcat 5 and Apache 2 for additional information on getting mod_jk2 and expanding the tar archive.

Building mod_jk2

  1. As root, run configure with the following options:

    [root@localhost native2]# ./configure --with-apxs2=/usr/sbin/apxs \
    > --with-apr-lib=/usr/lib \
    > --with-tomcat-41=$CATALINA_HOME \
    > --with-java-home=$JAVA_HOME \
    > --with-jni
    
  2. After configure executes successfully, you will need to to modify the Makefile inside ./server/apache2. Locate the following block:

    ifdef APR_LIBDIR_LA
    JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
    else
    JK_LDFLAGS=-lcrypt ${APR_LIBS}
    endif
    

    And change it to this:

    ifdef APR_LIBDIR_LA
    JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
    else
    JK_LDFLAGS=-lcrypt ${APR_LIBS} -laprutil-0
    endif
    

    Note the addition of -laprutil-0 in the second line.

  3. You can now run make as root user.

  4. After make completes, check that the file libjkjni.so is built with the necessary shared libraries. To do this, run ldd against that file. You should see something like this:

    [root@localhost modules]# ldd libjkjni.so
            libcrypt.so.1 => /lib/libcrypt.so.1 (0xb759e000)
            libapr-0.so.0 => /usr/lib/libapr-0.so.0 (0xb757f000)
            libaprutil-0.so.0 => /usr/lib/libaprutil-0.so.0 (0xb756a000)
            libc.so.6 => /lib/tls/libc.so.6 (0xb7431000)
            librt.so.1 => /lib/tls/librt.so.1 (0xb741d000)
            libm.so.6 => /lib/tls/libm.so.6 (0xb73fb000)
            libnsl.so.1 => /lib/libnsl.so.1 (0xb73e6000)
            libdl.so.2 => /lib/libdl.so.2 (0xb73e3000)
            libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb73d3000)
            libdb-4.1.so => /lib/libdb-4.1.so (0xb7310000)
            libexpat.so.0 => /usr/lib/libexpat.so.0 (0xb72f0000)
            /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) 
    

    The critical library is libaprutil-0.so.0 which must appear when you execute ldd. If you see the output above, your make process was successful. You will need to run the apxs tool against mod_jk2.so and copy that file and libjkjni.so to the modules directory of your Apache install.

  5. If your make process is successful, you should follow the rest of the instructions in the chapter "Integrating Tomcat 5 and Apache 2" to copy the relevant files to their respective directories and edit the configuration files.

If you have any difficulties with this process, please post your question to the Tomcat-Users mailing list.

Thanks go to Andrew Clute for this solution!