java.lang.RuntimeException:javax.net.ssl.SSLHandshakeException:收到致命警报:handshake_failure

Posted

技术标签:

【中文标题】java.lang.RuntimeException:javax.net.ssl.SSLHandshakeException:收到致命警报:handshake_failure【英文标题】:java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 【发布时间】:2018-08-10 22:51:42 【问题描述】:

我之前的客户端服务器连接工作正常,但几个月后它就停止工作了。以下是我找到的日志。

为了解决这个问题,我已将服务器的 Base-64 编码 x.509 证书导入客户端的 IBM Websphere Keystore。但这并没有什么不同!

可能是什么问题?

[1/29/18 15:25:04:701 EST] 000000be XXLogger E User: [system] App: [com.xx.xyz.atom.UvwConnector] java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 
    at org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:701) 
    at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:216) 
    at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:404) 
    at com.xx.xyz.atom.UvwConnector.callUvwGetString(UvwConnector.java:326) 
    at com.xx.xyz.atom.UvwConnector.callUvwLearning(UvwConnector.java:298) 
    at com.xx.xyz.atom.UvwConnector.getAllCourses(UvwConnector.java:42) 
    at com.xx.xyz.web.SearchListServlet.doPost(SearchListServlet.java:35) 
    at com.xx.xyz.web.SearchListServlet.doGet(SearchListServlet.java:26) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:575) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1225) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:775) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:457) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032) 
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87) 
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:908) 
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) 
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283) 
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) 
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) 
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) 
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815) 
    Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 
    at com.ibm.jsse2.o.a(o.java:31) 
    at com.ibm.jsse2.o.a(o.java:37) 
    at com.ibm.jsse2.SSLSocketImpl.b(SSLSocketImpl.java:468) 
    at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:527) 
    at com.ibm.jsse2.SSLSocketImpl.h(SSLSocketImpl.java:554) 
    at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:234) 
    at com.ibm.jsse2.k.write(k.java:24) 
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:76) 
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:134) 
    at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:828) 
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1565) 
    at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2116) 
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096) 
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) 
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) 
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) 
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) 
    at org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:688) 
    ... 32 more 

【问题讨论】:

您可能没有使用 WebSphere SSL 配置。如果您将服务器证书添加到 JDK 的 cacerts 文件中,一切正常吗?您正在使用 HttpClient,您是否使用 useSystemProperties() 选项调用它?如果没有 useSystemProperties() 选项,HttpClient 将不会使用 WebSphere SSLContext。 【参考方案1】:

“握手失败”通常意味着服务器的 TLS 级别(例如 TLS1.2)和密码套件以及您的 WebSphere 可以处理的内容之间没有重叠。

我将对服务器运行类似https://www.ssllabs.com/ssltest/ 的测试,然后在 WebSphere 安全 > SSL 证书和密钥管理 > SSL 配置中查看您的 QoP settings

【讨论】:

以上是关于java.lang.RuntimeException:javax.net.ssl.SSLHandshakeException:收到致命警报:handshake_failure的主要内容,如果未能解决你的问题,请参考以下文章

Android Studio 按钮导致崩溃

添加 ImageView 时应用程序崩溃?