HttpClient抛出SSLException:收到致命警报:decode_error

时间:2015-08-24 15:09:14

标签: java websphere-8

我在Websphere 8.5上运行了一个Java应用程序。我试图使用下面的代码调用第三方Web服务,但它失败了SSLException如下。

HttpClient httpClient = new HttpClient();
PostMethod post = new PostMethod(clientURL); 
post.addRequestHeader(....blah);    
httpClient.executeMethod(post);  // The error is thrown at this line `  

失败并出现以下错误:

 HttpMethodDir I org.apache.commons.httpclient.HttpMethodDirector executeWithRetry I/O exception (javax.net.ssl.SSLException) caught when processing request: Received fatal alert: decode_error`   

以下是完整的堆栈跟踪:

  

[8/21/15 16:33:08:997 EDT] 00000093 HttpMethodDir I   org.apache.commons.httpclient.HttpMethodDirector executeWithRetry I / O   处理请求时捕获异常(javax.net.ssl.SSLException):   收到致命警报:decode_error [8/21/15 16:33:08:997 EDT] 00000093   HttpMethodDir I org.apache.commons.httpclient.HttpMethodDirector   executeWithRetry重试请求[8/21/15 16:33:09:059 EDT] 00000093   HttpMethodDir I org.apache.commons.httpclient.HttpMethodDirector   抓住了executeWithRetry I / O异常(javax.net.ssl.SSLException)   处理请求时:收到致命警报:decode_error [8/21/15   16:33:09:059 EDT] 00000093 HttpMethodDir I   org.apache.commons.httpclient.HttpMethodDirector executeWithRetry   重试请求[8/21/15 16:33:09:122 EDT] 00000093 HttpMethodDir I   org.apache.commons.httpclient.HttpMethodDirector executeWithRetry I / O   处理请求时捕获异常(javax.net.ssl.SSLException):   收到致命警报:decode_error [8/21/15 16:33:09:122 EDT] 00000093   HttpMethodDir I org.apache.commons.httpclient.HttpMethodDirector   executeWithRetry重试请求[8/21/15 16:33:09:168 EDT] 00000093   SystemOut O在MessageSender中....结束sendMessage()[8/21/15   16:33:09:168 EDT] 00000093 servlet E.   com.ibm.ws.webcontainer.servlet.ServletWrapper服务SRVE0014E:   未捕获的service()异常根本原因/cova.jsp:   com.ibm.websphere.servlet.error.ServletErrorReport:   com.company.exception.ClientCommunicationException:无响应   收到了   org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:695)     在com.ibm._jsp._cova._jspService(_cova.java:147)at   com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)at   javax.servlet.http.HttpServlet.service(HttpServlet.java:668)at at   com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1225)     在   com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:775)     在   com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:457)     在   com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)     在   com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)     在   com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:216)     在   com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)     在   com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3761)     在   com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)     在   com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:975)     在   com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)     在   com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)     在   com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)     在   com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)     在   com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)     在   com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)     在   com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)     在   com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)     在   com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)     在   com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)     在   com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)     在com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)at at   com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)at at   com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)     在com.ibm.io.async.ResultHandler $ 2.run(ResultHandler.java:905)at   com.ibm.ws.util.ThreadPool $ Worker.run(ThreadPool.java:1815)

-Thanks。

1 个答案:

答案 0 :(得分:1)

我猜这里,但这里有几种可能性......

A:你应该在你的帖子URL中使用http而不是https(反之亦然)

B:您使用的是https且SSL证书无效

或C:您使用的是正确的网址,并且SSL有效,但您提供给API的身份验证无效且第三方API无法很好地处理