我正在运行Java 10 Webapp(不是我开发的,只是对其进行测试) wich具有嵌入式Tomcat,wich需要一些库,全部都在docker(compose)容器中,这是抛出的异常:
[org.apache.catalina.util.LifecycleBase#log(175)] Failed to initialize
component [Connector[org.apache.coyote.http11.Http11AprProtocol-8080]]
my-webapp | org.apache.catalina.LifecycleException: The configured
protocol [org.apache.coyote.http11.Http11AprProtocol] requires the
APR/native library which is not available
这是我的compose.yml: 版本:“ 3.1”
services:
my-webapp:
container_name: "my-webapp"
image: openjdk:10-jre-slim
hostname: my-webapp
volumes:
- ./lib:/home/lib
- ./my-webapp-1.0.1-SNAPSHOT-exec.jar:/home/my-webapp-1.0.1-
SNAPSHOT-exec.jar
- ./espera2minutos.sh:/home/espera2minutos.sh
command:
- sh /home/espera2minutos.sh
entrypoint:
- java
- -jar
#- -Djava.library.path=/home/lib
- -DLD_LIBRARY_PATH=/home/lib
- /home/my-webapp-1.0.1-SNAPSHOT-exec.jar
environment:
- LD_LIBRARY_PATH=/home/lib
- spring.datasource.url=jdbc:postgresql://postgresql:5432/my-
webapp
- spring.cassandra.contactpoints=cassandra
- spring.cassandra.port=9042
- spring.cassandra.keyspace=fulmar
#- spring.datasource.username=postgres
#- spring.datasource.password=postgres
#- spring.jpa.hibernate.ddlAuto=update+
#network_mode: bridge
ports:
- 8443:8443
- 8080:8080
#links:
# - postgresql
# - cassandra
depends_on:
- cassandra
问题是,当我的应用程序抛出代码1退出时容器死亡,但是在此之前,我能够在容器中运行命令,因此我确保有一个名为“ $ LD_LIBRARIES_PATH”的环境变量,其值是“ / home / lib”并运行 ls / home / bin我首先确保文件夹已正确安装,其次,两个所需的库“ libapr-1.so.0”和“ libtcnative-1.so.0”都存储在其中,但仍保持相同例外
希望有人可以在这里带来一些启发。预先感谢