Thursday, January 15, 2015

Oracle Taleo WebService Integration - "java.net.SocketException: Software caused connection abort: recv failed"

Recently I was trying to integrate Oracle Taleo WebService with one of the 3rd party system. I tried with WSDL2Java from the Apache Axis2 and SAAJ (SOAP with Attachments API for Java) types for the integration.

But on both the types I was getting "java.net.SocketException: Software caused connection abort: recv failed" issue. Below is the error detail.

org.apache.axis2.AxisFault: Software caused connection abort: recv failed 
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) 
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197) 
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75) 
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404) 
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231) 
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443) 
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406) 
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) 
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) 
at com.taleo.www.ws.tee800._2009._01.candidate.CandidateServiceStub.create(CandidateServiceStub.java:1284) 
at com.taleo.Generic.main(Generic.java:54) 
Caused by: java.net.SocketException: Software caused connection abort: recv failed 
at java.net.SocketInputStream.socketRead0(Native Method) 
at java.net.SocketInputStream.read(SocketInputStream.java:152) 
at java.net.SocketInputStream.read(SocketInputStream.java:122) 
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) 
at java.io.BufferedInputStream.read(BufferedInputStream.java:254) 
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78) 
at org.apache.commons.httpclient.HttpPars 

Solution:-

The error message that we are getting is not because of the java code, it's related to a HTTPS/SSL setup/configuration problem.

Connection to the Taleo zone requires use of the "HTTPS" protocol which uses "SSL". You need to Import the HTTPS Certificate into Java HTTPS certificates, this should solve the above issue.

Note:- If you are deploying your application to any web server, please check if the certificate is trusted by the 3rd party web server.

Steps to Import Certificate :-

  • Export the HTTPS Certificate into a file
    • Open your web browser
    •  Enter your web browser's "Options" utility. Internet Explorer users will need to click "Tools" and then "Internet Options," for example. Mozilla Firefox users will need to click "Tools" and then "Options..." Google Chrome users will need to click "Customize" and then "Options"
    • Click "Content" and then "Certificates" in Internet Explorer. Click on the certificate you'd like to export and then click on the "Export" button to export it for use on other servers
    • Click "Advanced" and then "View Certificates" in Mozilla Firefox. Click on the certificate you'd like to export and then click on the "Export" button to export it for use on other servers
    • Click "Under the Hood" and then "Manage Certificates" in Google Chrome. Click on the certificate you'd like to export and then click on the "Export" button to export it for use on other servers
  • Import the HTTPS Certificate into Java HTTPS certificates
    • Java HTTPS certificates stored in - $JAVA_HOME/jre/lib/security/cacerts
    • To import your new certificate into “cacerts” run below command:
“keytool -import -file amirssw.cer -keystore cacerts”
The Password is “changeit”