0
votes

I have a Java application running on Websphere 8.5. I am trying to call a 3rd party webservice using below code but it fails the SSLException as follows.

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

It fails with the below error:

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

Below is the full stacktrace:

[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)

-Thanks.

1
Please check the TLS version supported by your third party. I faced Received fatal alert: decode_error while connecting with apple cloud urls. I was able to fix it by explicitly setting the protocol as TLS 1.2. Reference - stackoverflow.com/questions/57103697/…Abbin Varghese

1 Answers

1
votes

I'm guessing here, but here's a few possibilities...

Either A: You should be using http as opposed to https in your post URL (or visa versa)

B : You are using https and the SSL Certificate is not valid

Or C : You are using the correct URL and SSL is valid yet the Authentication your providing to the API is invalid and not being handled very well by the third party API