Linux下Springboot解决`APR based Apache Tomcat Native library`提示
最近转行做java,开发基于Springboot的项目,版本号为2.1.0.RELEASE.
启动应用,发现以下提示:
The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.8-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
提示告知,使用基于Apache Tomcat Native library的ARP可以提升生产环境性能.
以下是从网上节选的话语:
apr是从操作系统级别解决
异步IO问题,大幅度提高服务器的并发处理性能,也是Tomcat生产环境运行的首选方式.
目前Tomcat 8.x默认情况下全部是运行在nio模式下,而apr的本质就是使用jni技术调用操作系统底层的IO接口.
如此具有诱惑力,当然值得花费时间去解决,按照网上教程安装依赖:
sudo apt-get isntall libapr1-dev libssl-dev libtcnative-1
此处,需要注意网上给出的资源大多数是libapr以及libtcnative,安装时提示无法找到.
因此,搜索到包名被修改成上述定义.
$ dpkg -L libtcnative-1
# 以下是输出信息
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libtcnative-1.a
/usr/lib/x86_64-linux-gnu/libtcnative-1.so.0.2.16
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/tcnative-1.pc
/usr/share
/usr/share/doc
/usr/share/doc/libtcnative-1
/usr/share/doc/libtcnative-1/README.Debian
/usr/share/doc/libtcnative-1/changelog.Debian.gz
/usr/share/doc/libtcnative-1/changelog.gz
/usr/share/doc/libtcnative-1/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libtcnative-1
/usr/lib/x86_64-linux-gnu/libtcnative-1.so
/usr/lib/x86_64-linux-gnu/libtcnative-1.so.0
使用dpkg可以得知,libtcnative-1的静态库被安装至:/usr/lib/x86_64-linux-gnu.
因此,启动程序:
java -jar -Djava.library.path=/usr/lib/x86_64-linux-gnu cache-0.0.1-SNAPSHOT.jar
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.1.RELEASE)
org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.13
2019-01-10 15:33:55.586 INFO 2243 --- [ main] o.a.catalina.core.AprLifecycleListener : An older version [1.2.16] of the APR based Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of [1.2.18]
2019-01-10 15:33:55.586 INFO 2243 --- [ main] o.a.catalina.core.AprLifecycleListener : Loaded APR based Apache Tomcat Native library [1.2.16] using APR version [1.6.3].
2019-01-10 15:33:55.586 INFO 2243 --- [ main] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2019-01-10 15:33:55.586 INFO 2243 --- [ main] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2019-01-10 15:33:55.597 INFO 2243 --- [ main] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.0h 27 Mar 2018]
2019-01-10 15:33:55.748 INFO 2243 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
输出的启动信息中,可以看到APR based Apache Tomcat Native library被加载了.
但是让人心塞的是,输出信息中提示版本过低,不满足现阶段使用的最小版本要求(差了两个小版本号).
An older version [1.2.16] of the APR based Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of [1.2.18]
根据网上搜索结果可知,无法通过apt-get去安装高版本的libtcnative,只能手动编译安装.
因此,去Tomcat官网下载(http://tomcat.apache.org/native-doc/),可以看到最新的版本号为1.2.19,于是下载源码包.
解压后可以看到目录结构:
.
├── build.properties.default
├── build.xml
├── CHANGELOG.txt
├── CMakeLists.txt
├── docs
├── examples
├── java
├── jnirelease.sh
├── LICENSE
├── native
├── NOTICE
├── README.txt
├── test
├── TODO.txt
└── xdocs
执行以下命令,进行编译安装:
sudo apt-get autoremove libtcnative-1 #删除安装的库
cd native
./configure && make -j 4
sudo make install
此处,configure命令无需按照官网指示配置参数,会自行搜索依赖所在路径.
安装完之后,可以得知静态库被安装至/usr/local/apr/lib.
重新启动程序:
java -jar -Djava.library.path=/usr/local/apr/lib cache-0.0.1-SNAPSHOT.jar
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.1.RELEASE)
o.a.catalina.core.AprLifecycleListener : Loaded APR based Apache Tomcat Native library [1.2.19] using APR version [1.6.3].
2019-01-10 15:48:29.130 INFO 7538 --- [ main] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2019-01-10 15:48:29.130 INFO 7538 --- [ main] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2019-01-10 15:48:29.136 INFO 7538 --- [ main] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.0h 27 Mar 2018]
2019-01-10 15:48:29.255 INFO 7538 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
通过输出信息,可以得知:程序完美加载APR based Apache Tomcat Native library,性能就等着提升了.
将参数设置到idea的VM options中,调试的时候也舒服了许多.
PS:
如果您觉得我的文章对您有帮助,可以扫码领取下红包,谢谢!
Linux下Springboot解决`APR based Apache Tomcat Native library`提示的更多相关文章
- The APR based Apache Tomcat Native library 异常解决办法
tomat在linux服务器上启动报The APR based Apache Tomcat Native library which allows optimal performance in pro ...
- 【问题解决:信息提示】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 ...
- 解决:The APR based Apache Tomcat Native library which allows optimal performance in production...
tomcat日志apr报错引发的基于Tomcat Native加速Tomcat性能 tomact服务启动报错日志如下:息: The APR based Apache Tomcat Native lib ...
- springboot An incompatible version [1.1.32] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
1.错误 An incompatible version [1.1.32] of the APR based Apache Tomcat Native library is installed, wh ...
- 关于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 ...
- 关于The APR based Apache Tomcat Native library警告
今天在Eclipse上配置Tomcat7,启动时看到如下警告信息: The APR based Apache Tomcat Native library which allows optimal pe ...
- 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 ...
- The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:
运行环境: Intellij idea 14 在改了项目名称. 运行时候出现了 The APR based Apache Tomcat Native library which allows opti ...
- IDEA搭建ssm框架测试衍生出的问题The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Develop\jdk7\jdk1.7.0_79\bin;
最近玩起IDEA这开发工具,搭建ssm框架测试时,部署项目出现如下问题: 信息: The APR based Apache Tomcat Native library which allows opt ...
随机推荐
- MySQL中group_concat函数深入理解
本文通过实例介绍了MySQL中的group_concat函数的使用方法,比如select group_concat(name) . 一.MySQL中group_concat函数 完整的语法如下: gr ...
- python之12306自动查票
一.导读 本篇文章所采用的技术仅用于学习.研究,任何其他用途请自行承担后果. 12306自动查票使用到的python库主要是splinter,同时也涉及到查票的城市编码,具体的城市编码请在网络上搜 ...
- 火狐浏览器插件--xpath利器
以前在做web自动化的时候,免不了要找定位啊什么的.一层层找下来太痛苦了,时间也浪费了一天写不了啥.特别是在最开始接触自动化的时候,我们系统坑爹的只支持IE.后来换公司了,在偶然情况下,得知了fire ...
- get.go
//获取空间文件 )) resp, err := http.DefaultClient.Do(req) if err != nil { return nil, err ...
- Hibernate Annotation 生成数据库表(UUId)
User.java实体类 package com.tao.pojo; import javax.persistence.Column; //用注解的方式生成表 import javax.persist ...
- bzoj5153&uoj348 【WC2018】州区划分
五十分就是裸的O(3^n)子集dp. $$f[S]*{w[S]^{p}}=\sum_{T \in S}{f[T]*{w[S-T]^{p}}}$$ 然后我们考虑优化这个dp,我们发现这是子集卷积的形式, ...
- BZOJ_1100_[POI2007]对称轴osi_KMP+计算几何
BZOJ_1100_[POI2007]对称轴osi_KMP+计算几何 Description FGD小朋友——一个闻名遐迩的年轻数学家——有一个小MM,yours.FGD小朋友非常喜欢他的MM,所以他 ...
- Ceilometer + Aodh + Gnocchi 介绍
一. Ceilometer 1. 概述 Openstack ceilometer主要用于监控虚拟机.服务(glance.image.network等)和事件.虚拟机的监控项主要包括CPU.磁盘 ...
- linux系统版本查看
Linux下如何查看版本信息, 包括位数.版本信息以及CPU内核信息.CPU具体型号等等,整个CPU信息一目了然. 1.# uname -a (Linux查看版本当前操作系统内核信息) Lin ...
- 列举Java中常用的包、类和接口
常用的类: BufferedReader ,BufferedWriter FileReader ,FileWirter String ,Integer Date ,Cla ...
