gpt4 book ai didi

java - HttpClient 抛出 SSLException : Received fatal alert:decode_error

转载 作者:行者123 更新时间:2023-12-01 11:12:30 24 4
gpt4 key购买 nike

我有一个在 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 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 Retrying request [8/21/15 16:33:09:059 EDT] 00000093 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:09:059 EDT] 00000093 HttpMethodDir I org.apache.commons.httpclient.HttpMethodDirector executeWithRetry Retrying request [8/21/15 16:33:09:122 EDT] 00000093 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:09:122 EDT] 00000093 HttpMethodDir I org.apache.commons.httpclient.HttpMethodDirector executeWithRetry Retrying request [8/21/15 16:33:09:168 EDT] 00000093 SystemOut O In MessageSender....end of sendMessage() [8/21/15 16:33:09:168 EDT] 00000093 servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception root cause /cova.jsp: com.ibm.websphere.servlet.error.ServletErrorReport: com.company.exception.ClientCommunicationException: No response received at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:695) at 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 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.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:216) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3761) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:975) 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)

-谢谢。

最佳答案

我在这里猜测,但这里有一些可能性......

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

B:您正在使用 https 并且 SSL 证书无效

或者 C :您使用了正确的 URL 并且 SSL 有效,但您向 API 提供的身份验证无效并且第三方 API 没有很好地处理

关于java - HttpClient 抛出 SSLException : Received fatal alert:decode_error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32185718/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com