Java 我应该在生产中使用什么 tomcat 本机库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2231163/
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-08-13 05:00:22  来源:igfitidea点击:

what tomcat native library should I be using in production?

javaspringspring-mvc

提问by Blankman

When I compile my spring mvc app, I get this in the output:

当我编译我的 spring mvc 应用程序时,我在输出中得到了这个:

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_17\bin;......

What exactly should I use in production that this is referring to?

我到底应该在生产中使用什么?

采纳答案by Kevin

Tomcat-nativeis a version of Tomcat that uses the highly optimized Apache Portable Runtime (APR), the same framework that powers the Apache HTTP server.

Tomcat-nativeTomcat 的一个版本,它使用高度优化的 Apache Portable Runtime (APR),该框架与为 Apache HTTP 服务器提供支持的框架相同。

回答by Aito

I found a postout there:

我在那里找到了一个帖子

You can safely ignore this message if you want. Basically it is telling you that an optional shared library (dll on Windows) is not found. The APR is the Apache Portable Runtime. This is a native (non-java) library that can improve the performance of Tomcat in certain situations. On both Windows and Unix/Linux you will need a C compiler to build this library.

如果需要,您可以放心地忽略此消息。基本上它告诉你没有找到一个可选的共享库(Windows 上的 dll)。APR 是 Apache Portable Runtime。这是一个原生(非java)库,可以在某些情况下提高Tomcat的性能。在 Windows 和 Unix/Linux 上,您都需要一个 C 编译器来构建这个库。

回答by nos

Take a look at this talk , http://www.infoq.com/presentations/Tuning-Tomcat-Mark-Thomas, where one of the Tomcat developers discuss how to tune Tomcat - including which of the connectors (Like NIO or APr) to consider. The message you get about APR is referring to Tomcat Native

看看这个演讲,http://www.infoq.com/presentations/Tuning-Tomcat-Mark-Thomas,其中一位 Tomcat 开发人员讨论了如何调整 Tomcat - 包括哪些连接器(如 NIO 或 APr)考虑。您收到的有关 APR 的消息是指Tomcat Native

回答by Zeeshan Akhter

My case: Seeing the same INFO message.

我的情况:看到相同的 INFO 消息。

Centos 6.2 x86_64 Tomcat 8.0.14

Centos 6.2 x86_64 Tomcat 8.0.14

This fixed the problem for me:

这为我解决了问题:

yum install tomcat-native

yum 安装 tomcat-native

回答by Neha Garg

I was very new to Tomcat and faced the same problem; I think it was because I didn't stop the server properly.

我对 Tomcat 很陌生,遇到了同样的问题;我认为这是因为我没有正确停止服务器。

In Eclipse, on the Server tab, right-click Tomcat and click "Clean". Restart the server. It worked for me.

在 Eclipse 中,在 Server 选项卡上,右键单击 Tomcat,然后单击“Clean”。重新启动服务器。它对我有用。

回答by Stuart Cardall

To get APRworking on a Windows server:

APRWindows 服务器上工作:

  • install the APR native libsinto the Tomcat bindirectory (for 64 bituse the tcnativefiles in the x64subfolder)

  • add the Tomcat binfolder to the Windows %path%(this adds opensslto your path)

  • APR 本机库安装到 Tomcatbin目录中(用于 64 bit使用子文件夹tcnative中的x64文件)

  • 将 Tomcatbin文件夹%path%添加openssl到Windows (这会添加到您的路径中)

Additional Notes:

补充说明:

You cannot use a Java keystorewith the APRconnector as it expects certificates in the normal Apache format. To convert a pfxcertificate I used:

您不能将 JavakeystoreAPR连接器一起使用,因为它需要普通 Apache 格式的证书。要转换pfx我使用的证书:

openssl pkcs12 -in domain.pfx -clcerts -nokeys -out domain.cer
openssl pkcs12 -in domain.pfx -nocerts -nodes  -out domain.key
openssl pkcs12 -in domain.pfx -out domain-ca.crt -nodes -nokeys -cacerts

You will then be able to uncomment / enable the example SSLusing the APRconnector in Tomcat's server.xml

然后,您将能够SSL使用APRTomcat 中的连接器取消注释/启用示例server.xml