天天看点

linux下启动tomcat报错APR/native library which is not available的解决方案

在linux上使用tomcat8配置支持http2.0的时候,server.xml的配置文件里面有这么一段配置:

<Connector port="45501" protocol="org.apache.coyote.http11.Http11AprProtocol" 
               SSLEnabled="true"
               maxThreads="150"
               scheme="https" 
               secure="true"
               clientAuth="true"
               sslProtocol="TLS" 
               SSLCertificateFile="/export/apps/modelsafe/certificate/haier.net.pem"
               SSLCertificateKeyFile="/export/apps/modelsafe/certificate/haier.net.key.pem"
               truststoreFile="/export/apps/modelsafe/certificate/ags.trust.jks"
               truststorePass="haierags"/>
           

但是启动tomcat报错如下:

linux下启动tomcat报错APR/native library which is not available的解决方案

这是因为配置里面指定使用协议是org.apache.coyote.http11.Http11AprProtocol,即需要用APR运行模式,但这并不是tomcat默认的运行模式(此外还有bio和nio模式),需要额外安装apr-devel、apr、apr-util和tomcat-native的包才行。

通过root用户执行如下命令即可:

 yum install apr-devel apr apr-util tomcat-native -y