This document is intended to explain how to get the JK2 connector to work with Apache2 and Tomcat 4.1.18+. This document provides a step by step process for doing so.
Building
- Download the jakarta-tomcat-connectors package
- install httpd-devel and httpd RPMs
- Ensure you have libtool, gcc and the various build tools
- go into the jakarta-tomcat-connectors/jk/ directory
- edit build.properties. Set "apache2.home" to /usr and "apache2.include" to /usr/include/httpd.
- if you have apache13 installed in a separate dir - set apache13.home=DIR, otherwise set it to "none"
- if you are on gentoo - apache2.include will be /usr/include/apache2
- if you built your own apache - it must be APACHE/include
- On Red Hat 8, make a symlink between /usr/lib/libapr.so to /usr/lib/libapr-0.so ( the "right" name )
If you are building using configure/make:
- See note (below) regarding some changes you may need to make to a Makefile
- go into the jk/native2 directory
- type ./buildconf.sh
- type ./configure --with-apxs=(location of your apxs installed by apache-devel)
- an actual sample configure:
./configure --with-apxs2=/usr/sbin/apxs --with-apache2-lib=/usr/lib --with-tomcat41=/usr/local/tomcat-4 --with-apr-lib=/usr/lib --with-jni
- an actual sample configure:
- type make
- mod_jk2.so and libjkjni.so will be in jk/build/jk2/apache2/
- instructions on using libtool to finish are emitted at the end of the make process
If you are building using ant:
- do "ant jkant" ( in j-t-c/jk ). This will build the ant tasks
- cd native2
- "ant"
- mod_jk2.so will be in jk/build/jk2/apache2,
- libjkjni.so will be in jk/builld/jk2/jni
After you compile:
- copy mod_jk2.so to APACHE/modules
- copy libjkjni.so to JAVA_HOME/jre/lib/i386 ( you can also modify java.library.path - but this is simpler )
Note: depending upon version and configuration, you may need to modify the Makefile. Those changes are needed if the sources are older than JTC_M1 ( Apr 10, 2003 ? )
In native2/server/apache/Makefile.in, find the line:
No Format |
---|
JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt -lapr-0 <at:var at:name="PCRE_LIBS" />
|
In order to compile and run on my Red Hat 8.0 installation the following changes are required:
No Format |
---|
JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt -lapr-0 '''-laprutil -lgdbm -lexpat -ldb''' <at:var at:name="PCRE_LIBS" />
|
The changes are in bold. The changes are only necessary if you actually intend to use jkini.so, e.g., for UNIX domain sockets.
NOTE: this was to build with the RH 8 binary distribution of Apache, which provides libapr. Notice the difference between what RH 8 distributes, and an official Apache distribution of 2.0.44:
No Format |
---|
1356728 Feb 16 23:45 httpd-2.0.44/srclib/apr/.libs/libapr-0.so.0.9.2
772970 Feb 16 23:46 httpd-2.0.44/srclib/apr-util/.libs/libaprutil-0.so.0.9.2
|
No Format |
---|
205700 Oct 9 08:04 /usr/lib/libapr.so.0.0.0
102532 Oct 9 08:04 /usr/lib/libaprutil.so.0.0.0
|
You should also replace jkjni
with libjkjni
.
Configuration
page is obsolete. All content was removed. See the Connectors documentation on the Tomcat site.
...
CategoryObsoleteSee Self:Tomcat/Jk2Connector (Using the JK2 Connector)