本文主要是介绍tomcat8启动异常:APR/native library which is not available,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
cetos7.0环境下启动tomcat8,报如下错误
Tomcat ans APR lib : requires the APR/native library which is not available
查看tomcat配置文件service.xml
<Connector port="18702" protocol="org.apache.coyote.http11.Http11AprProtocol"connectionTimeout="20000"redirectPort="8443" maxThreads="500"minSpareThreads="20"acceptCount="100"disableUploadTimeout="true"enableLookups="false"URIEncoding="UTF-8"/>
这是因为配置里面指定使用协议是org.apache.coyote.http11.Http11AprProtocol,即需要用APR运行模式,但这并不是tomcat默认的运行模式(此外还有bio和nio模式),需要额外安装apr和native的包才行。
需要安装以下几个包
- openssl-1.0.2(支持http2.0的话需要1.0.2以上版本,此处安装的openssl-1.0.2k)
- apr
- apr-util
- tomcat-native(这个包在tomcat的bin目录下带的有)
安装过程
1、安装openssl
tar xzvf openssl-1.0.2k.tar.gz
cd openssl-1.0.2k
./config --prefix=/usr/local/openssl --shared
make
make test
make install
mv /usr/bin/openssl /usr/bin/openssl.OFF
mv /usr/include/openssl /usr/include/openssl.OFF
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
echo "/usr/local/openssl/lib">>/etc/ld.so.conf
ldconfig -v
openssl version -a
2、安装apr
tar -zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make
make install
3、安装apr-util
tar zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr --with-apr-iconv=/usr/local/apr-iconv/bin/apriconv
make
make install
4、安装tomcat-native
cd ****** #tomcat安装路径
tar -zxvf tomcat-native.tar.gz
cd tomcat-native-1.2.10-src/native
./configure --with-apr=/usr/local/apr --with-java-home=/opt/jdk1.7.0_67 --with-ssl=/usr/local/openssl
make
make install
这篇关于tomcat8启动异常:APR/native library which is not available的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!