[精讚] [會員登入]
838

更新java版本後一定要做的事情

how to deal with PKIX path building failed issue after upgrade java sdk version in IDE

分享此文連結 //n.sfs.tw/14820

分享連結 更新java版本後一定要做的事情@外行中的外行
(文章歡迎轉載,務必尊重版權註明連結來源)
2020-11-23 21:58:55 最後編修
2020-11-20 23:34:34 By jung
 

每次編譯器更新java sdk版本後,例如這次我從openjdk11.0.5升級到11.0.8

就會出現:javax.net.ssl.SSLHandshakeException: PKIX path building failed

編譯或執行時出錯

找到解法如下:

1.先下載該網站公開憑證

例如我想連到 google.com 透過 HTTPS執行程式或下載

使用openssl先產生該網站的crt憑證檔案

openssl s_client -connect google.com:443 -servername google.com:443 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > public.crt

2.再匯到jvm的cacert 中,這邊一定要找到jdk版本中keytool的絕對路徑

例如:/Library/Java/JavaVirtualMachines/adoptopenjdk-11-openj9.jdk/Contents/Home/bin/keytool

<JAVA_HOME>/bin/keytool -import -alias <server_name> -keystore <JAVA_HOME>/jre/lib/security/cacerts -file public.crt

 

這樣就可以解決了

參考文件

https://confluence.atlassian.com/kb/how-to-import-a-public-ssl-certificate-into-a-jvm-867025849.html

END

你可能感興趣的文章

unknown issue after downgrade to intellij idea community version 使用社群版遇到的奇怪問題

intellij IDEA git設定說明 whenever using git push fuction in the intellij IDEA

如何用git log功能產生有固定格式的commit紀錄 how to create a git commit history log file with custom format

使用letsEncrypt替換docker容器內的nginx https憑證 using cerbot for nginx on oracle linux 9

安裝netbeans9遇到的小狀況 how to show netbeans9 program onto ubuntu desktop

在intellij IDEA解決檔案內容顯示為UTF-8字碼而不是中文的問題 how to show correct language content of file, instead of utf-8 encoded charactors

我有話要說

>>

限制:留言最高字數1000字。 限制:未登入訪客,每則留言間隔需超過10分鐘,每日最多5則留言。

訪客留言

[無留言]

隨機好文

縣市端新增syncdata spi功能 為了讓部裡主機可以透過OAUTH2流程,呼叫縣市同步SYNCDATA 的API

如何用git log功能產生有固定格式的commit紀錄 how to create a git commit history log file with custom format

更新java版本後一定要做的事情 how to deal with PKIX path building failed issue after upgrade java sdk version in IDE

啟動chrome時要求須輸入密碼enter password to unlock login keyring asking for entering password to unlock login kerying on Ubuntu desktop

使用bash script 顯示及比較記憶體剩餘用量 How to get the available memory reported as a percentage then compare Numbers and Strings in Linux Shell Script