问题描述:
换过tomcat版本,换过jdk版本,也换过tomcat/bin/下的tomcat-native,以及以为是ssl证书的问题。
1、启动tomcat后,查看netstat -tlnpu查看端口8443端口一直起不来。
2、查看log日志有如下错误
The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:
问题解决步骤:
1、查看jdk是否安装,如未安装,请安装(我这里直接rpm包安装的)
#rpm -qa |grep jdk
#sudo rpm -ivh jdk-**.rpm
或者下载源码包安装(源码安装省略,可查看其他博客)
2、查看apr是否安装(如未安装,请安装)
#rpm -qa |grep apr
#sudo yum install -y apr apr-devel
或者源码安装
3、安装tomcat-native (在tomcat/bin/下)
#sudo tar zxvf tomcat-native.tar.gz
#cd tomcat-native-1.1.14-src/native
#sudo ./configure --with-java-home=/usr/java/jdk1.8.0_60/
#sudo make
#sudo make install
备注:/usr/java/jdk1.8.0_60/是rpm包安装的目录,个人环境不同就不一样。
4、设置 apr 的环境变量:
#vi /etc/profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
#source /etc/profile
5、重启tomcat,使生效。
6、附上server.xml的配置截取ssl如下
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
maxThreads="150" SSLEnabled="true" >
<SSLHostConfig>
<Certificate SSLCertificateFile="/home/yingjiahulian_BOS/tomcat/conf/ssl/certs/rickricks.com-cert.cer"
SSLCertificateKeyFile="/home/yingjiahulian_BOS/tomcat/conf/ssl/private/rickricks.com.key"
type="RSA" />
</SSLHostConfig>
</Connector>
转载于:https://blog.51cto.com/zxlwz/2054832