Getting Tomcat5 to use Native Libraries on RHEL 5

While working on the OnTrace deployment I noticed the following INFO message in the Tomcat start up logs:

INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path

The Apache Tomcat Native library is what tomcat uses for OS level communication and native process handling, using a natively compiled version helps improve performance. There’s more information here, http://tomcat.apache.org/tomcat-5.5-doc/apr.html

To get tomcat to use the native library on RHEL5 here are the steps I took:

yum install apr openssl apr-devel openssl-devel (you'll also need gcc and make installed)

Download the tomcat distribution for the version you’re using, RHEL is currently using 5.5.23,

http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.23/bin/apache-tomcat-5.5.23.tar.gz

From the tar extract the native library source from the bin dir:

tar xvzf apache-tomcat-5.5.23.tar.gz

cp apache-tomcat-5.5.23/bin/tomcat-native.tar.gz .

tar xvzf tomcat-native.tar.gz

cd /tomcat-native-1.1.6-src/jni/native

./configure && make && make install

If this completes successfully it should build the native libraries in /usr/local/apr/lib

UPDATE If ./configure is failing with a message unable to find apr than add –with-apr=/usr/local/apr-1-config

add this directory to /usr/share/tomcat5/conf/tomcat5.conf

JAVA_OPTS="-Djava.libaray.path=/usr/lib:/usr/local/apr/lib"

Restart tomcat and check your logs, the message should now be gone.

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply