Compile and install APR
root needed!
Download source packages, apr-1.5.2.tar.gz and apr-util-1.5.4.tar.gz, from Apache site, https://apr.apache.org/download.cgi
Unpack the packages to /root/apache/apr-1.5.2 and /root/apache/apr-util-1.5.4
Installation path: /usr/local/apr
# compile and install apr # /root/apache/apr-1.5.2 ./configure --prefix=/usr/local/apr make make install
# compile and install apr-util #/root/apache/apr-util-1.5.4 ./configure --prefix=/usr/local/apr/lib --with-apr=/usr/local/apr make make install
For Tomcat
Compile and install tomcat native
Go to tomcat/bin, unpack tomcat-native.tar.gz, then go to tomcat-native-1.1.29-src/jni/native, compile and install tomcat-native
# /home/root/apache-tomcat-7.0.53/bin/tomcat-native-1.1.29-src/jni/native ./configure --with-apr=/usr/local/apr --with-java-home=/usr/lib/jvm/java-VERSION-oracle/ make make install
Configuration
In the start script of Tomcat, add
CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib"
In conf/server.xml, update protocol of connectors to use the following protocols,
org.apache.coyote.http11.Http11AprProtocol org.apache.coyote.ajp.AjpAprProtocol
Restart tomcat, if you see the following in the catalina.out and no exception, the APR is running.
... INFO: Loaded APR based Apache Tomcat Native library 1.1.29 using APR version 1.5.2. Nov 26, 2015 2:58:54 PM org.apache.catalina.core.AprLifecycleListener init ...