Tomcat7 with APR on Centos

1、yum install apr openssl apr-devel openssl-devel

2、rpm -ql apr
/usr/lib64/libapr-1.so.0
/usr/lib64/libapr-1.so.0.2.7
/usr/share/doc/apr-1.2.7
/usr/share/doc/apr-1.2.7/CHANGES
/usr/share/doc/apr-1.2.7/LICENSE
/usr/share/doc/apr-1.2.7/NOTICE
/usr/lib/libapr-1.so.0
/usr/lib/libapr-1.so.0.2.7
/usr/share/doc/apr-1.2.7
/usr/share/doc/apr-1.2.7/CHANGES
/usr/share/doc/apr-1.2.7/LICENSE
/usr/share/doc/apr-1.2.7/NOTICE

3、wget  http://labs.mop.com/apache-mirror//tomcat/tomcat-connectors/native/1.1.24/source/tomcat-native-1.1.24-src.tar.gz

4、tar -xvf tomcat-native-1.1.24-src.tar.gz

5、cd ~/tomcat-native-1.1.24-src/jni/native

CFLAGS=’-arch x86_64′

./configure –with-apr=/usr/bin/apr-1-config –without-ssl –with-java-home=/opt/java/jdk/current

make

make install

6、sudo vi /etc/profile

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib

7、vi /opt/java/tomcat/conf/server.xml

<Listener className=”org.apache.catalina.core.AprLifecycleListener” SSLEngine=”off” />

<Executor name=”tomcatThreadPool” namePrefix=”catalina-exec-” maxThreads=”500″ minSpareThreads=”100″ prestartminSpareThreads=”false”/>
<Connector executor=”tomcatThreadPool” port=”8081″ protocol=”org.apache.coyote.http11.Http11AprProtocol” connectionTimeout=”10000″ redirectPort=”8443″ enableLookups=”false”/>
<Connector executor=”tomcatThreadPool” port=”9091″ protocol=”org.apache.coyote.ajp.AjpAprProtocol” connectionTimeout=”1000″ keepAliveTimeout=”6000″ redirectPort=”8443″ acceptorThreadCount=”5″ acceptCount=”500″/>

参考资料

http://www.philipandrew.com/?p=91

http://lists.centos.org/pipermail/centos/2007-November/046773.html

http://www.jroller.com/agileanswers/entry/configuring_apr_for_tomcat

//checking for APR… configure: error: the –with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.
–with-apr的路径不正确。

centos 5.7
默认的apr版本比较低
需要先安装
apr-1.4.8
再执行
./configure –with-apr=/usr/local/apr –with-ssl –with-java-home=/data/java/jdk/current
不能使用
./configure –with-apr=/usr/bin/apr-1-config –with-ssl –with-java-home=/data/java/jdk/current
否则报错

 
src/poll.c: In function 'Java_org_apache_tomcat_jni_Poll_create':
src/poll.c:112: error: 'APR_POLLSET_NOCOPY' undeclared (first use in this function)
src/poll.c:112: error: (Each undeclared identifier is reported only once
src/poll.c:112: error: for each function it appears in.)
src/poll.c: In function 'Java_org_apache_tomcat_jni_Poll_poll':
src/poll.c:306: warning: implicit declaration of function 'APR_RING_FOREACH'
src/poll.c:306: error: expected expression before 'tcn_pfde_t'
src/poll.c:307: error: expected ';' before '{' token
src/poll.c: In function 'Java_org_apache_tomcat_jni_Poll_maintain':
src/poll.c:399: warning: implicit declaration of function 'APR_RING_FOREACH_SAFE'
src/poll.c:399: error: expected expression before 'tcn_pfde_t'
src/poll.c:400: error: expected ';' before '{' token
src/poll.c:392: warning: unused variable 'now'
src/poll.c:391: warning: unused variable 'num'
src/poll.c:391: warning: unused variable 'i'
src/poll.c: In function 'Java_org_apache_tomcat_jni_Poll_pollset':
src/poll.c:471: error: expected expression before 'tcn_pfde_t'
src/poll.c:472: error: expected ';' before '{' token
make[1]: *** [src/poll.lo] Error 1
make[1]: Leaving directory `/data/install/tomcat-native-1.1.27-src/jni/native'
make: *** [all-recursive] Error 1
 
 
 
sudo apt-get install libapr1-dev libssl-dev
 
./configure --with-apr=/usr/bin/apr-1-config —-with-ssl=yes
 
make && sudo make install
http://tomcat.apache.org/native-doc/
Libraries have been installed in:
/usr/local/apr/lib

原创文章,转载请注明: 转载自海波无痕

本文链接地址: Tomcat7 with APR on Centos

文章的脚注信息由WordPress的wp-posturl插件自动生成

此条目发表在server分类目录,贴了, , , , , 标签。将固定链接加入收藏夹。

Tomcat7 with APR on Centos》有 1 条评论

  1. Linuno说:

    标记一下。

    通过 yum install 的 apr 怎么也找不到,原来要先安装 apr-devel,而且要使用 apr-1-config.

    [回复]

发表评论

电子邮件地址不会被公开。 必填项已用*标注

评论链接可以 移除 nofollow.