3
使用HttpsURLConnection
類在Java中使用HTTPS連接到服務器時,我得到了問題標題中所述的異常。另外我試圖跳過使用the second last answer的證書驗證。任何人都可以請任何方式建議我嗎?javax.net.ssl.SSLException:收到致命警報:使用Java和https的bad_record_mac
更新1:堆棧跟蹤
javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1720)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:133)
at com.kuliza.sitepulse.thread.HttpConnectionThread.run(HttpConnectionThread.java:77)
at java.lang.Thread.run(Thread.java:662)
我得到的代碼行除外:http.connect();
,其中http
是類型HttpsURLConnection
類。
更新2:SSL記錄
下面是SSL握手日誌:
[Raw read]: length = 5
0000: 15 03 00 00 02 .....
[Raw read]: length = 2
0000: 02 14 ..
Thread-6, READ: SSLv3 Alert, length = 2
Thread-6, RECV SSLv3 ALERT: fatal, bad_record_mac
Thread-6, called closeSocket()
任何鉛請,這是推動我堅果!
在此先感謝!
運行帶有'-Djavax.net.debug = all',連接嘗試?它會輸出很多*調試信息,這可能會幫助您縮小錯誤的位置。 – FauxFaux 2012-02-22 17:29:26
嗨@FauxFaux我說,因爲你建議,也更新了這個問題,但我仍然無能爲力 – devsri 2012-02-23 10:56:36
也許這將幫助:https://support.sonatype.com/entries/22070546-deploy-fails-with-received-fatal -alert壞記錄-MAC – yegor256 2012-10-08 18:44:00