接收SSLHandshakeException:尽管我的客户忽略了所有证书,但handshake_failure
我有一个Java程序,它使用SSL / TLS连接到Web服务器,并通过该连接发送各种HTTP请求。服务器是本地主机,并且使用自签名证书,但我的代码使用自定义信任管理器,并忽略无效的证书。到目前为止,它一直完美地工作。
服务器上唯一的区别是它曾经运行jboss 6,现在运行jboss 7。我不确定这是否是配置问题,或者我的代码是否存在问题,但是如果我尝试使用其他基于Java的程序(如WebScarab或ZAP)进行连接,我会收到相同的错误。
无论如何,我可以对我的代码做些什么来解决这个问题吗?以下是完整的错误:
Received fatal alert: handshake_failure
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
以下是失败前的调试消息:
main, WRITE: TLSv1 Handshake, length = 75
main, WRITE: SSLv2 client hello message, length = 101
main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1 ALERT: fatal, handshake_failure