亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將 .jar 許可證文件添加到 Docker 映像的類路徑?

將 .jar 許可證文件添加到 Docker 映像的類路徑?

慕碼人2483693 2023-09-13 15:41:10
我有一個 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-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條經驗 獲得超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"]



查看完整回答
反對 回復 2023-09-13
  • 1 回答
  • 0 關注
  • 94 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號