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. 应用CRM的自动化功能为什么备受推崇

    相信每个销售团队都遇到过这样的问题:在跟进新客户的时候顾此失彼,在跟踪一个客户的时候,转眼就忘记了另一个客户.这种情况很常见,但是每个新客户都有潜在的价值,我们该如何做,才能避免错失商机?CRM客户管 ...

  2. php安裝7.3版本

    CentOS 安装 EPEL 源: yum install epel-release 安装 REMI 源: CentOS 7: yum install http://rpms.remirepo.net ...

  3. linux学习之路第四天

    用户和用户组的配置文件

  4. angular小记

    declarations:包装组件或指令等 providers:依赖注入 imports:导入其他模块 bootstrap:设置根组件 exports:导出组件或指令等 app.component.t ...

  5. Python3.7 lxml引入etree

    用xml代替lxml,Python3.7中已经没有etree这个模块了 import xml.etree.ElementTree as etree from lxml import etree 这种方 ...

  6. 高校表白App-团队冲刺第四天

    今天要做什么 就如昨天所说,今天继续进行引导页制作的学习.并开始通过ViewPager做简单的布局与Activity. 遇到的问题 本来以为只是使用一个ViewPager控件就可以搞定,原来还是需要配 ...

  7. Python+Requests+Re(正则)爬取某糗事百科图片(数据分析一)

    1.博客目前在学习爬虫课程,使用正则表达式来爬取网页的图片信息 2.下面我们一起来回归下Python中的正则使用方式/方法 3.糗事百科图片爬取源码如下: import requestsimport ...

  8. 【Mysql】一个简易的索引方案

    一.没有索引的时候如何查找 先忽略掉索引这个概念,如果现在直接要查某条记录,要如何查找呢? 在一个页中查找 如果表中的记录很少,一个页就够放,那么这时候有 2 种情况: 用主键为搜索条件:这时就是之前 ...

  9. redis数据类型及应用场景

    0.key的通用操作 KEYS * keys a keys a* 查看已存在所有键的名字 ****TYPE 返回键所存储值的类型 ****EXPIRE\ PEXPIRE 以秒\毫秒设定生存时间 *** ...

  10. python 接口测试之 图片识别

    4.1 pytesser安装 2.安装pytesser,下载地址:http://code.google.com/p/pytesser/ ,下载后直接将其解压到项目代码下,或者解压到python安装目录 ...