Saturday, September 16, 2006

Enable Apache Portable Runtime in Tomcat 5

If Apache Portable Runtime is not enabled in Tomcat 5.

On startup you will see:

INFO main org.apache.catalina.core.AprLifecycleListener - The Apache Portable Runtime which allows optimal performance in production environments was not found on the java.library.path:


And then on shutdown:

INFO main org.apache.catalina.core.AprLifecycleListener - Failed shutdown of Apache Portable Runtime

Do the following to enable APR.
  • Install apr packages using #yum -y install apr apr-util apr-devel apr-util-devel.
  • Download tomcat5 in tar.gz format and install tomcat5.
  • > cd /bin
    > ungzip tomcat-native.tar.gz
    > tar -xvf tomcat-native.tar
    > cd tomcat-native-/jni/native
  • >./configure --with-java-home= --with-apr=/usr/bin/apr-1-config
    >make
    >make install (switch to root)
  • > cd /jre/lib/i386
    > ln -s /usr/local/apr/lib/libtcnative-1.a libtcnative-1.a
    > ln -s /usr/local/apr/lib/libtcnative-1.so libtcnative-1.so
    > ln -s /usr/local/apr/lib/libtcnative-1.so.2 libtcnative-1.so.2
    > ln -s /usr/local/apr/lib/pkgconfig/ pkgconfig
And now Tomcat doesn't complain anymore. The Tomcat log file also states something new:

INFO main org.apache.coyote.http11.Http11AprProtocol - Starting Coyote HTTP/1.1 on http-8180

No comments: