Monday, August 13, 2012

How to install Apache Tomcat Native library on CentOS 5.5

If you see this in your tomcat log

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:
/usr/java/jdk1.6.0_24/jre/lib/amd64/server:/usr/java/jdk1.6.0_24/jre/lib/amd64:/usr/java/jdk1.6.0_24/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

Do so:

yum install apr-devel

Download package from http://tomcat.apache.org/download-native.cgi

cd tomcat-native-1.1.20-src/jni/native/

You must have java installed (I use sun-java). Since you are using tomcat, it is already installed, isn't it?

./configure --with-apr=/usr/bin/apr-1-config

In any case you will get (I don't know, I've not investigated)

configure: error: can't locate a valid JDK location

btw

./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/java/jdk1.6.0_24

make

su -

make install

At this point you must inform tomcat where this library is located

We can add
-Djava.library.path=/usr/local/apr/lib
to JAVA_OPTS in the catalina.sh script

or add
export LD_LIBRARY_PATH="/usr/local/apr/lib"
at the begginning of the same script

1 comment:

  1. I made it with

    ./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/java/latest

    which is somewhat "version indipendent"

    ReplyDelete