eclipse “未找到基于 APR 的 Apache Tomcat 本机库”是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8716259/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:48:41  来源:igfitidea点击:

What does "The APR based Apache Tomcat Native library was not found" mean?

eclipsetomcatapr

提问by fresh_dev

I am using Tomcat 7 in Eclipse on Windows. When starting Tomcat, I am getting the following info message:

我在 Windows 上的 Eclipse 中使用 Tomcat 7。启动 Tomcat 时,我收到以下信息消息:

The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path

在 java.library.path 中找不到基于 APR 的 Apache Tomcat Native 库,该库可在生产环境中实现最佳性能

What does this mean and how can I provide the APR library?

这是什么意思,我如何提供 APR 库?

回答by GreyFairer

It means exactly what it says: "The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path"

它的意思正是它所说的:“在 java.library.path 上找不到允许在生产环境中获得最佳性能的基于 APR 的 Apache Tomcat Native 库”

The library referred to is bundled into an OS specific dll (tcnative-1.dll) loaded via JNI. It allows tomcat to use OS functionalities not provided in the Java Runtime (such as sendfile, epoll, OpenSSL, system status, etc.). Tomcat will run just fine without it, but for some use cases, it will be faster with the native libraries.

所引用的库被捆绑到通过 JNI 加载的特定于操作系统的 dll (tcnative-1.dll) 中。它允许 tomcat 使用 Java 运行时未提供的操作系统功能(例如 sendfile、epoll、OpenSSL、系统状态等)。Tomcat 没有它也能正常运行,但对于某些用例,使用本机库会更快。

If you really want it, download the tcnative-1.dll(or libtcnative.sofor Linux)and put it in the bin folder, and add a system property to the launch configuration of the tomcat server in eclipse.

如果你真的想要它,下载tcnative-1.dll(or libtcnative.sofor Linux)并将其放在bin文件夹中,并在eclipse中将系统属性添加到tomcat服务器的启动配置中。

 -Djava.library.path=c:\dev\tomcat\bin

回答by Matthew Farwell

Unless you're running a production server, don't worry about this message. This is a library which is used to improve performance (on production systems). From Apache Portable Runtime (APR) based Native library for Tomcat:

除非您正在运行生产服务器,否则不要担心此消息。这是一个用于提高性能的库(在生产系统上)。来自基于 Apache Portable Runtime (APR) 的 Tomcat 原生库

Tomcat can use the Apache Portable Runtime to provide superior scalability, performance, and better integration with native server technologies. The Apache Portable Runtime is a highly portable library that is at the heart of Apache HTTP Server 2.x. APR has many uses, including access to advanced IO functionality (such as sendfile, epoll and OpenSSL), OS level functionality (random number generation, system status, etc), and native process handling (shared memory, NT pipes and Unix sockets).

Tomcat 可以使用 Apache Portable Runtime 提供卓越的可扩展性、性能以及与本机服务器技术的更好集成。Apache Portable Runtime 是一个高度可移植的库,它是 Apache HTTP Server 2.x 的核心。APR 有很多用途,包括访问高级 IO 功能(例如 sendfile、epoll 和 OpenSSL)、操作系统级功能(随机数生成、系统状态等)和本机进程处理(共享内存、NT 管道和 Unix 套接字)。

回答by user911734

On RHEL Linux just issue:

在 RHEL Linux 上只需发出:

yum install tomcat-native.x86_64

/Note:depending on Your architecture 64bit or 32bit package may have different extension/

/注意:根据您的架构,64位或32位包可能有不同的扩展名/

That is all. After that You will find in the log file next informational message:

就这些。之后,您将在日志文件中找到下一条信息性消息:

INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

All operations will be noticeably faster than before.

所有操作都将明显比以前快。

回答by Amadu Bah

Installation the native library on Ubuntu server with:

使用以下命令在 Ubuntu 服务器上安装本机库:

sudo apt-get install libtcnative-1

If that does not work tomcat-native needs to be installed

如果不行就需要安装tomcat-native

  1. Install Oracle java7:

    • sudo add-apt-repository ppa:webupd8team/java
    • sudo apt-get update
    • sudo apt-get install oracle-java7-installer
    • sudo apt-get install oracle-java7-set-default
  2. Install tomcat apr:

  3. Install tomcat tomcat-native:

  1. 安装 Oracle java7:

    • 须藤添加-apt-repository ppa:webupd8team/java
    • sudo apt-get 更新
    • sudo apt-get install oracle-java7-installer
    • 须藤 apt-get 安装 oracle-java7-set-default
  2. 安装tomcat apr:

  3. 安装 tomcat tomcat-native:

回答by Russell Rottach

I just went through this and configured it with the following:

我刚刚经历了这个并使用以下内容对其进行了配置:

Ubuntu 16.04

Ubuntu 16.04

Tomcat 8.5.9

雄猫 8.5.9

Apache2.4.25

Apache2.4.25

APR 1.5.2

4 月 1.5.2

Tomcat-native 1.2.10

Tomcat 原生 1.2.10

Java 8

爪哇 8

These are the steps i used based on the older posts here:

这些是我根据此处的旧帖子使用的步骤:

Install package

安装包

sudo apt-get update
sudo apt-get install libtcnative-1

Verify these packages are installed

验证这些软件包是否已安装

sudo apt-get install make 
sudo apt-get install gcc
sudo apt-get install openssl

Install package

安装包

sudo apt-get install libssl-dev

sudo apt-get install libssl-dev

Install and compile Apache APR

安装和编译 Apache APR

cd /opt/tomcat/bin
sudo wget http://apache.mirror.anlx.net//apr/apr-1.5.2.tar.gz
sudo tar -xzvf apr-1.5.2.tar.gz
cd apr-1.5.2
sudo ./configure
sudo make
sudo make install

verify installation

验证安装

cd /usr/local/apr/lib/
ls 

you should see the compiled file as

你应该看到编译后的文件

libapr-1.la

libapr-1.la

Download and install Tomcat Native source package

下载安装Tomcat Native源码包

cd /opt/tomcat/bin
sudo wget https://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.2.10/source/tomcat-native-1.2.10-src.tar.gz
sudo tar -xzvf tomcat-native-1.2.10-src.tar.gz
cd tomcat-native-1.2.10-src/native

verify JAVA_HOME

验证JAVA_HOME

sudo pico ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
source ~/.bashrc
sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
sudo make
sudo make install

Edit the /opt/tomcat/bin/setenv.sh file with following line:

使用以下行编辑 /opt/tomcat/bin/setenv.sh 文件:

sudo pico /opt/tomcat/bin/setenv.sh
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'

restart tomcat

重启tomcat

sudo service tomcat restart

sudo service tomcat restart

回答by MSalters

Had this problem as well. If you dohave the libraries, but still have this error, it may be a configuration error. Your server.xmlmay be missing the following line:

也有这个问题。如果您确实有这些库,但仍然出现此错误,则可能是配置错误。您server.xml可能缺少以下行:

 <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />

(Alternatively, it may be commented out). This <Listener>, like other listeners is a child of the top-level <Server>.

(或者,它可以被注释掉)。this<Listener>和其他侦听器一样是顶级<Server>.

Without the <Listener>line, there's no attempt to load the APR library, so LD_LIBRARY_PATHand -Djava.library.path=settings are ignored.

没有<Listener>线,没有尝试装入APR库,所以LD_LIBRARY_PATH-Djava.library.path=设置将被忽略。

回答by Hasan Ramezani

on debian 8 I fix it with installing libapr1-dev:

在 debian 8 上,我通过安装来修复它libapr1-dev

apt-get install libtcnative-1 libapr1-dev

回答by Ryan Wibawa

On Mac OS X:

在 Mac OS X 上:

$ brew install tomcat-native
==> tomcat-native
In order for tomcat's APR lifecycle listener to find this library, you'll
need to add it to java.library.path. This can be done by adding this line
to $CATALINA_HOME/bin/setenv.sh

  CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/opt/tomcat-native/lib"

If $CATALINA_HOME/bin/setenv.sh doesn't exist, create it and make it executable.

Then add it to the eclipse's tomcat arguments (double-clickServer > Open Launch Configuration> Arguments tab > VM arguments)

然后将其添加到 eclipse 的 tomcat 参数中(双击Server > Open Launch Configuration> Arguments tab > VM arguments

-Djava.library.path=/usr/local/opt/tomcat-native/lib

回答by Stephen Paul

I had this issue upgrading from Java 8 to 11. After adding this dependency, my app launched without issue:

从 Java 8 升级到 11 时遇到了这个问题。添加此依赖项后,我的应用程序启动没有问题:

<dependency>
    <groupId>org.javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.25.0-GA</version>
</dependency>

回答by Abd Abughazaleh

My problem was in add some library from tomcat to eclipse class path i just going to eclipse click right to project and going to debug configuration -> classpath -> Add External JARsadd all jars files from apache-tomcat-7.0.35\binthis was my problem and it's worked for me .
enter image description here

我的问题是将一些库从 tomcat 添加到 eclipse 类路径,我只是要 eclipse 单击右侧的项目并从中debug configuration -> classpath -> Add External JARs添加所有 jars 文件,apache-tomcat-7.0.35\bin这是我的问题,它对我有用。
在此处输入图片说明