慕碼人2483693
2023-09-13 15:41:10
我有一個 springboot 應用程序,它連接到 DB2 數(shù)據(jù)庫,然后檢索一些數(shù)據(jù)并為其提供 REST 端點。為了促進這一點,許可證被添加到應用程序的類路徑中,以允許它與 DB2 數(shù)據(jù)庫進行通信。這有效。但是,當我在本地構建和鏡像并運行該鏡像時,我收到一條錯誤,指出許可證不存在。{ "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"}我假設這是因為許可證現(xiàn)在不包含在 Docker 容器類路徑中。我對此進行了相當多的研究,但看不到任何關于我將如何做到這一點的指示。因此,任何幫助將不勝感激。我的許可證保存在項目根目錄的 lib 文件夾中,是一個 jar 文件。我的泊塢窗文件:FROM openjdk:8-jdk-alpineVOLUME /tmpARG JAR_FILECOPY target/mydb2jdbcproject-1.jar mydb2jdbcproject-1.jarCOPY lib/db2jcc_license_cisuz.jar db2jcc_license_cisuz.jar#CLASSPATH: lib/db2jcc_license_cisuz.jar/EXPOSE 8080ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","mydb2jdbcproject-1.jar"]
1 回答

守候你守候我
TA貢獻1802條經(jīng)驗 獲得超10個贊
我最終不得不在運行之前更改用于手動設置多個類路徑的 CMD,并且由于某種原因它無法與 -jar 一起使用,因此我必須通過啟動器類運行。
生成的 dockerfile 如下所示:
FROM openjdk:8-jdk-alpine
RUN mkdir -p /opt/mvp2/db2jdbc /opt/mvp2/app
COPY target/db2new-0.1.jar /opt/mvp2/app/
COPY jdbc/db2jcc4.jar /opt/mvp2/db2jdbc/
COPY jdbc/db2jcc_license_cisuz.jar /opt/mvp2/db2jdbc/
CMD ["java","-classpath","/opt/mvp2/db2jdbc/db2jcc4.jar:/opt/mvp2/db2jdbc/db2jcc_license_cisuz.jar:/opt/mvp2/app/db2new-0.1.jar:.","org.springframework.boot.loader.JarLauncher"]
添加回答
舉報
0/150
提交
取消