spring-boot - The APR based Apache Tomcat Native library was not found on the java.library.path warning in Spring Boot Docker App

标签 spring-boot docker tomcat native apr

当我的 Spring Boot 应用程序在 Amazon Corretto Docker 容器中运行时,我看到以下警告-

o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]

最佳答案

我的 Dockerfile 片段:

FROM amazoncorretto:8
RUN yum update -y && yum install -y apr-devel && yum install -y openssl-devel && yum install -y gcc && yum install -y make && yum install -y tar && yum install -y gzip
RUN curl "http://apache.spinellicreations.com/tomcat/tomcat-connectors/native/1.2.23/source/tomcat-native-1.2.23-src.tar.gz" -o ./tomcat-native-1.2.23-src.tar.gz
RUN tar zxf ./tomcat-native-1.2.23-src.tar.gz -C .
RUN cd tomcat-native-1.2.23-src/native/
RUN ./tomcat-native-1.2.23-src/native/configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/lib/jvm/java-1.8.0-amazon-corretto/
RUN make && make install
RUN cp -r /usr/local/apr/lib/* /usr/lib/ 

        .... MORE

Dockerfile 中添加的上述命令对我有用。感谢以下资源帮助我找到要添加到 Dockerfile 的命令:

How to install Apache Tomcat Native library

Find out where JAVA is

Tomcat Native / OpenSSL in Spring Boot 2.0

我还没有运行测试来比较结果以查看是否有任何改进。

关于spring-boot - The APR based Apache Tomcat Native library was not found on the java.library.path warning in Spring Boot Docker App,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57708552/

相关文章:

java - spring boot中如何读写文件

java - Proguard 与 Spring Boot - 集成测试

docker - 排除使用 Docker Compose 启动某些容器

macos - 构建并推送多拱 docker 镜像

java - Auto Scaling 无法在 Elastic Beanstalk 中与 Tomcat 一起正常工作

Eclipse中Tomcat下的Java ClassNotFoundException

tomcat - 如何每 3 小时轮换一次 Jboss 日志文件?

java - Spring boot - 使用动态 TTL 周期驱逐缓存

Spring Boot安全配置忽略允许的端点

ssl - 如何配置 Let's encrypt 证书用于 docker 镜像中的 nginx?