我有一个 springboot 应用程序,它连接到 DB2 数据库,然后检索一些数据并为其提供 REST 端点。为了促进这一点,许可证被添加到应用程序的类路径中,以允许它与 DB2 数据库进行通信。这有效。但是,当我在本地构建和镜像并运行该镜像时,我收到一条错误,指出许可证不存在。
{
"timestamp": 1569854043909,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.jdbc.CannotGetJdbcConnectionException",
"message": "Could not get JDBC Connection; nested exception is com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][t4][10509][13454][4.26.14] Connection to the data server failed. The IBM Data Server for JDBC and SQLJ license was invalid \nor was not activated for the DB2 for z/OS subsystem. If you are connecting directly to \nthe data server and using DB2 Connect Unlimited Edition for System z, perform the \nactivation step by running the activation program in the license activation kit. \nIf you are using any other edition of DB2 Connect, obtain the license file, \ndb2jcc_license_cisuz.jar, from the license activation kit, and follow the installation \ndirections to include the license file in the class path. ERRORCODE=-4230, SQLSTATE=42968",
"path": "/test"
}
我假设这是因为许可证现在不包含在 Docker 容器类路径中。我对此进行了相当多的研究,但看不到任何关于我将如何做到这一点的指示。因此,任何帮助将不胜感激。
我的许可证保存在项目根目录的 lib 文件夹中,是一个 jar 文件。
我的泊坞窗文件:
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY target/mydb2jdbcproject-1.jar mydb2jdbcproject-1.jar
COPY lib/db2jcc_license_cisuz.jar db2jcc_license_cisuz.jar
#CLASSPATH: lib/db2jcc_license_cisuz.jar/
EXPOSE 8080
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","mydb2jdbcproject-1.jar"]
守候你守候我
相关分类