1. 安装apr(版本 apr-1.5.2)
# ./configure
# make;make install
2. 安装apr-iconv(版本 apr-iconv-1.2.1)
# ./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr
# make;make install
3. 安装apr-util(版本 apr-util-1.5.4)
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make;make install
这个包是Apache官网tomcat自带的,位置在 /usr/local/tomcat/bin目录下
# tar zxf tomcat-native.tar.gz
当前目录下生成 tomcat-native-1.1.30-src的目录
# cd tomcat-native-1.1.30-src/jni/native
# ./configure --with-apr=/usr/local/apr --with-java-home=/jdk1.6.0_29
# make;make install
添加/usr/local/apr/lib到 ld.so.conf文件
# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/apr/lib
保存
# ldconfig 使生效
2.2 配置tomcat启动时支持apr
# vi bin/catalina.sh
JAVA_OPTS="-server -Xms1024m -Xmx3072m -XX:PermSize=128M -XX:MaxPermSize=256m -XX:ParallelGCThreads=4 -XX:+UseNUMA" CATALINA_OPTS=-Djava.library.path=/usr/local/apr/lib
启动tomcat
# bin/startup.sh
查看启动日志
tail logs/catalina.out
Jun 4, 2015 3:45:41 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-18009
Jun 4, 2015 3:45:41 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5100 ms
停止tomcat时,日志中有下面内容表示停止成功
Jun 4, 2015 3:51:29 PM org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-18080
Jun 4, 2015 3:51:29 PM org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8443
Jun 4, 2015 3:51:29 PM org.apache.coyote.ajp.AjpAprProtocol destroy
INFO: Stopping Coyote AJP/1.3 on ajp-18009
至此,ARP与tomcat结合完成。