我一直在研究從動態(tài)Web應(yīng)用程序中提取信息的程序,該程序運(yùn)行良好,直到我將tomcat服務(wù)器設(shè)置為使用自簽名(因此,不受信任)證書使用SSL為止。錯誤的堆棧跟蹤為:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetError: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1584) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:848) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106) at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495) at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:877) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1089) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1116) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1100) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:402) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:170) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:857)在Web瀏覽器中,當(dāng)用戶使用不受信任的證書訪問HTTPS站點時,系統(tǒng)會提示用戶警告,并要求他設(shè)置是否愿意繼續(xù)進(jìn)行操作;我想為我的命令行應(yīng)用程序?qū)崿F(xiàn)類似的功能...我承認(rèn)我是套接字編程和網(wǎng)絡(luò)領(lǐng)域的新手。解決這個問題的任何建議都會很棒!
3 回答

蝴蝶不菲
TA貢獻(xiàn)1810條經(jīng)驗 獲得超4個贊
另一個選擇是獲取該特定服務(wù)器的“ .pem”(公鑰)文件,然后將其本地安裝到JRE的“證書”文件的中心,然后它將能夠從該服務(wù)器下載而不會受到任何損害,而不會受到影響。您正在運(yùn)行的JVM的整個SSL結(jié)構(gòu),并允許從其他未知證書服務(wù)器下載...
添加回答
舉報
0/150
提交
取消