![](/img/trans.png)
[英]Java - getting error with audio input stream for opening mp3 file
[英]SSL error while opening input stream
我想我想了解SSL的工作原理,我將基於grails的應用程序作為應用程序過程的一部分,必須打開與第三方應用程序的“ https”連接。 但是遇到以下異常
"sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"
雖然與URL的連接工作正常,但是當我嘗試打開輸入流以讀取數據時會發生錯誤。 問題是打開連接時是否應該有證書問題? 附加了代碼段
try{
URL url= new URL("https://.../..")
def c = url.openConnection()
println("connection successful with Merchant")
def result = c.inputStream.text?.trim() // results in error
println(result)
}
catch (Exception exp){
println("error !!!")
println(exp.getMessage())
}
對於剛開始使用SSL和證書管理的人們來說,這是一個非常普遍的問題。 我在博客AllInGeek.com上的標題為“導入非知名證書”的文章中用非常詳細的示例和命令回答了這個問題。
這僅表示您要連接的Web服務器或URL沒有來自授權CA的有效證書。
您可以與另一個SSL網站進行驗證,或按照此處的步驟操作:
http://www.java-samples.com/showtutorial.php?tutorialid=210
通過導入服務器證書來解決此問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.