tomcat:jar包内置tomcat(9.0.62)
jdk:1.8.0_281
系统:linux(centos7)
linux上启动tomcat apr模式失败,报错:
The configured protocol [org.apache.coyote.http11.Http11AprProtocol] requires the APR/native library
linux上没有tomcat apr模式的lib文件
1、tomcat官网下载tomcat
官网地址(9.0.x版本):https://tomcat.apache.org/download-90.cgi
2、linux上安装tomcat native 编译依赖
# 使用yum安装依赖
yum install apr-devel
yum install openssl-devel
yum install gcc
yum install make
# 安装java,并配置环境变量
可参考:https://blog.csdn.net/yukikaze_nanoda/article/details/125767964
3、编译tomcat native
# 解压下载的tomcat
tar -zxvf apache-tomcat-9.0.71
# 进入tomcat/bin内,解压tomcat-native.tar.gz
cd apache-tomcat-9.0.71/bin/
tar -zxvf tomcat-native.tar.gz
# 进入 native 并编译安装
cd tomcat-native-1.2.35-src/native/
./configure && make && make install
4、配置lib
# 进入/usr/lib/,创建软连接,完成配置
cd /usr/local
ln -s /usr/local/apr/lib/libtcnative-1.so
ln -s /usr/local/apr/lib/libtcnative-1.so.0