Abdera SSLHandshakeException
Abdera SSLHandshakeException
我的 SSL 握手有一个小问题,我尝试启动 GET 请求,服务器 return 我 java.lang.RuntimeException:javax.net.ssl.SSLHandshakeException.
我正在使用 Abdera 连接 Connections Server,在 Websphare 上我确实安装了 Connections Site 的 SSL,但这不起作用,我的代码是:
public static void send(HttpServletRequest req, HttpServletResponse respo) 抛出异常{
String back = "";
String connectionsUser = req.getHeader("user");
String connectionsPassword = req.getHeader("password");
Abdera abdera = new Abdera();
AbderaClient abderaClient = new AbderaClient(abdera);
AbderaClient.registerTrustManager();
System.out.println(connectionsUser + " " + connectionsPassword);
abderaClient.addCredentials(Utils.configJson.getString("connectionsServer"), null, null, new UsernamePasswordCredentials(connectionsUser, connectionsPassword));
ClientResponse resp = abderaClient.get(Utils.configJson.getString("connectionsServerURL") + Utils.configJson.getString("profileService"));
日志是:
[8/27/15 17:14:56:663 CDT] 0000007c SystemErr R java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:701)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:216)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:404)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at com.cemex.services.ProfileServiceDo.send(ProfileServiceDo.java:71)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at com.cemex.services.ProfileServiceDo.doGet(ProfileServiceDo.java:38)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1071)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3774)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.ResultHandler.run(ResultHandler.java:905)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.jsse2.o.a(o.java:36)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.o.a(o.java:43)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.SSLSocketImpl.b(SSLSocketImpl.java:32)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:626)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.SSLSocketImpl.h(SSLSocketImpl.java:39)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:696)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.k.write(k.java:26)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:76)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:134)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1525)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R at org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:688)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R ... 30 more
您知道 SSL 会发生这种情况还是如何解决?
谢谢。
如果您是 运行 WebSphere Application Server 上的应用程序,则应将 Connections Server 导入 CellDefaultTrustSTore。
Log into the IBM WebSphere Application Server Integrated Solutions Console and select Security > SSL Certificate and key management > Key stores and certificates.
Click CellDefaultTrustStore.
Click Signer Certificates.
Click Retrieve from port.
Enter the Host name, SSL Port, and Alias of the web server. The Alias is typically an arbitrary string that will become the name of the credentials.
Click Retrieve Signer Information and then click OK. The root certificate is added to the list of signer certificates.
之后您必须同步节点
我的 SSL 握手有一个小问题,我尝试启动 GET 请求,服务器 return 我 java.lang.RuntimeException:javax.net.ssl.SSLHandshakeException.
我正在使用 Abdera 连接 Connections Server,在 Websphare 上我确实安装了 Connections Site 的 SSL,但这不起作用,我的代码是:
public static void send(HttpServletRequest req, HttpServletResponse respo) 抛出异常{
String back = "";
String connectionsUser = req.getHeader("user");
String connectionsPassword = req.getHeader("password");
Abdera abdera = new Abdera();
AbderaClient abderaClient = new AbderaClient(abdera);
AbderaClient.registerTrustManager();
System.out.println(connectionsUser + " " + connectionsPassword);
abderaClient.addCredentials(Utils.configJson.getString("connectionsServer"), null, null, new UsernamePasswordCredentials(connectionsUser, connectionsPassword));
ClientResponse resp = abderaClient.get(Utils.configJson.getString("connectionsServerURL") + Utils.configJson.getString("profileService"));
日志是:
[8/27/15 17:14:56:663 CDT] 0000007c SystemErr R java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:701)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:216)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:404)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at com.cemex.services.ProfileServiceDo.send(ProfileServiceDo.java:71)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at com.cemex.services.ProfileServiceDo.doGet(ProfileServiceDo.java:38)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
[8/27/15 17:14:56:664 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1071)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3774)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[8/27/15 17:14:56:665 CDT] 0000007c SystemErr R at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.io.async.ResultHandler.run(ResultHandler.java:905)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702)
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
[8/27/15 17:14:56:666 CDT] 0000007c SystemErr R at com.ibm.jsse2.o.a(o.java:36)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.o.a(o.java:43)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.SSLSocketImpl.b(SSLSocketImpl.java:32)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:626)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.SSLSocketImpl.h(SSLSocketImpl.java:39)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:696)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at com.ibm.jsse2.k.write(k.java:26)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:76)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:134)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1525)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
[8/27/15 17:14:56:668 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R at org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:688)
[8/27/15 17:14:56:669 CDT] 0000007c SystemErr R ... 30 more
您知道 SSL 会发生这种情况还是如何解决?
谢谢。
如果您是 运行 WebSphere Application Server 上的应用程序,则应将 Connections Server 导入 CellDefaultTrustSTore。
Log into the IBM WebSphere Application Server Integrated Solutions Console and select Security > SSL Certificate and key management > Key stores and certificates.
Click CellDefaultTrustStore.
Click Signer Certificates.
Click Retrieve from port.
Enter the Host name, SSL Port, and Alias of the web server. The Alias is typically an arbitrary string that will become the name of the credentials.
Click Retrieve Signer Information and then click OK. The root certificate is added to the list of signer certificates.
之后您必须同步节点