1.问题

启动Tomcat之后,在浏览器输入IP后显示503,查看catalina.log发现报错:

2.问题定位:缺少 tomcat-native library

就是说 缺少Tomcat Native librayr的支持, 因此需要安装 Tomcat Native library。

安装参考 Tomcat-APR/tomcat-native-1.2.23-src源码安装和配置The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path

当然二者都是参考官网 来安装 tomcat-native库:

3.安装tomcat-native 步骤

安装环境:

  • Linux版本:CentOS Linux release 7.9.2009
  • apache-tomcat-9.0.41
  • openjdk version "1.8.0_292"

3.1 确认gcc、apr、apr-devel、apr-util 以及 JDK是否已经安装过,没有就需要安装

# 1.确认 gcc, 若已安装就会显示安装的版本
rpm -qa gcc
# gcc-4.8.5-28.el7_5.1.x86_64
#没有就安装 yum install gcc
# 2.确认 apr, 没有就 yum install gcc
rpm -qa apr
# 3.确认 apr-devel,没有就 yum install apr-devel
rpm -qa apr-devel
# 4.确认 apr-util, 没有就 yum install apr-util
rpm -qa apr-util
# 5. 确认 JDK,没有就 yum install -y java-1.8.0-openjdk
which java
java -version

3.2. 源码安装tomcat-native-1.2.23

下载地址:官网

下载到 /opt 目录下,tar zxvf tomcat-native-1.2.23-src.tar.gz 解压 ,进入 tomcat-native-1.2.23-src/native ,然后参考官方给的模板执行:

./configure --with-apr=/usr/bin/apr-1-config \
--with-java-home=/home/jfclere/JAVA/jdk1.7.0_80/ \
--with-ssl=yes \
--prefix=$CATALINA_HOME
  • --with-java-home:jdk的安装目录,笔者是 yum install -y java-1.8.0-openjdk 安装的,因此是 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64
  • --prefix:Tomcat安装目录
## 笔者的命令
./configure --with-apr=/usr/bin/apr-1-config \
--with-java-home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64 \
--with-ssl=yes \
--prefix=/usr/local/apache-tomcat-9.0.41

然后 编译安装 make && make install 成功后会看到如下的内容:

Libraries have been installed in:
/usr/local/apache-tomcat-9.0.41/lib If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

即库已经安装到之前 --prefix指定目录下的 lib子目录中,同时还需要以下操作:

修改 /usr/local/apache-tomcat-9.0.41/bin/catalina.sh ,在 文件末尾添加

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apache-tomcat-9.0.41/lib
export LD_LIBRARY_PATH

再在 /usr/local/apache-tomcat-9.0.41/conf/server.xml 配置 Tomcat Connector,将 protocol修改成如下内容:

<Connector port="80" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
redirectPort="8443" />

重启Tomcat服务器 问题就解决了

The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path 问题解决记录的更多相关文章

  1. 关于Tomcat启动时报The APR based Apache Tomcat Native library which allows optimal performanc e in production environments was not found on the java.library.path

    错误信息如下 八月 01, 2016 10:11:15 上午 org.apache.catalina.core.AprLifecycleListener initINFO: The APR based ...

  2. The APR based Apache Tomcat Native library 异常解决办法

    tomat在linux服务器上启动报The APR based Apache Tomcat Native library which allows optimal performance in pro ...

  3. The APR based Apache Tomcat Native library

    Tomcat启动的时候出现下面这样的提示: 2015-11-06 14:24:12 org.apache.catalina.core.AprLifecycleListener init 信息: The ...

  4. 关于The APR based Apache Tomcat Native library警告

    今天在Eclipse上配置Tomcat7,启动时看到如下警告信息: The APR based Apache Tomcat Native library which allows optimal pe ...

  5. The APR based Apache Tomcat Native library tomcat启动错误

    The APR based Apache Tomcat Native library which allows optimal performance in production environmen ...

  6. Linux下Springboot解决`APR based Apache Tomcat Native library`提示

    最近转行做java,开发基于Springboot的项目,版本号为2.1.0.RELEASE. 启动应用,发现以下提示: The APR based Apache Tomcat Native libra ...

  7. An incompatible version [1.1.29] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]

    问题描述   首先,这是一个提示信息而不是报错,并不影响 Tomcat 的使用.它是建议你使用一个 Tomcat 的性能调优原生库文件 tcnative-1.dll   几天前,我想尝试一下 Apac ...

  8. Tomcat开启本地库(Apache Tomcat Native Library)支持

    操作系统环境:Ubuntu 17 amd64位 软件环境:Tomcat 9 tomcat安装位置:/opt/tomcat JDK:1.8.144 64位  安装步骤: 1:编译安装 cd /opt/t ...

  9. 【问题解决:信息提示】SpringBoot启动时提示The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path

    问题描述 springboot程序在启动时提示信息 [2018-10-24 21:59:05.214] - 440 信息 [restartedMain] --- org.apache.catalina ...

随机推荐

  1. 资源:Postgresql数据库下载路径

    postgresql下载路径: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

  2. 其他:Spring5.0框架源码导入IDEA

    1.下载Spring spring-framework-5.0.4.RELEASE下载地址:https://github.com/spring-projects/spring-framework/re ...

  3. 深入浅出图神经网络 第6章 GCN的性质 读书笔记

    第6章 GCN的性质 第5章最后讲到GCN结束的有些匆忙,作为GNN最经典的模型,其有很多性质需要我们去理解. 6.1 GCN与CNN的区别与联系 CNN卷积卷的是矩阵某个区域内的值,图卷积在空域视角 ...

  4. 物理机连接虚拟机中的数据库及Windows添加防火墙允许端口详细操作步骤

    公司项目中因为会使用到SQL server数据库,但是自己电脑无论安装2008R2或者2014版本都不成功,我想可能是和之前安装的一些Windows的软件存在冲突. 于是便单独创建了一台虚拟机,在虚拟 ...

  5. 题解 guP4552 IncDec Sequence

    这道题是一道差分的题目 差分数组p即p[i]=a[i]-a[i-1] 如果我们把一个区间[l,r]里的数+1,那么我们不难发现p[l]'=a[l]+1-a[l-1]=p[l]+1,p[r+1]'=a[ ...

  6. 我的第一个MVC程序(SpringMVC的环境搭建与实例运用)

    做一个完整点的mvc框架的搭建流程吧 Spring包含jar包下载 SpingMVC是基于Spring的一种关于web的解决方案,所以,使用springMVC,首先要准备有关Spring的一些jar包 ...

  7. Java异常情况

    从网上了解了这些Java异常,遇到过一些,大部分还没遇到: 1. SQLException:操作数据库异常类. 2. ClassCastException:数据类型转换异常. 3. NumberFor ...

  8. 关于高校表白App的NABCD项目分析

    N(Need,需求) 首先,针对本校男多女少 的具体情况,为广大本校大学生提供一个更加宽广的平台: 其次,针对当前各高校均有校园表白墙的实际情况,各表白墙难以整合在一起,使得信息不够集中的现状,我们小 ...

  9. Kubernetes实战:高可用集群的搭建和部署

    摘要:官方只提到了一句"使用负载均衡器将 apiserver 暴露给工作节点",而这恰恰是部署过程中需要解决的重点问题. 本文分享自华为云社区<Kubernetes 高可用集 ...

  10. 计算机毕业设计选题大合集,含ssm,springboot,小程序,php,python

    1基于springboot医院急诊系统 2基于springboot校园闲置物品租售系统 3基于springboot校园闲置物品交易网站 4基于springboot图书网站 5基于springboot外 ...