• Community
  • Discussions
  • Received fatal alert: handshake_failure when making request from java6 and targeted java is version8

Received fatal alert: handshake_failure when making request from java6 and targeted java is version8

I am facing a problem with java compatibility, here is the detail about the SSL handshake:

javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1839)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1019)

--------------------------------------------------------------------

Here I am able to make a request with java 8 but not with java 6.

I need a solution to make this request with java 6 version because my client application is with java 6 version, here java8 up-gradation is not possible for time being.

My code is:

package ziraPOC;
import java.io.*;
import java.net.*;

public class JiraCreateIssue {

public static void main(String[] args) {
try {
URL jiraREST_URL = new URL("https://my-jira.com/rest/api/2/issue/");
String myvar = "{"
+ " \"fields\": {"
+ " \"project\":"
+ " { "
+ " \"key\": \"RMP\""
+ " },"
+ " \"summary\": \"REST ye merry gentlemen.\","
+ " \"description\": \"Creating of an issue using project keys and issue type names using the REST API\","
+ " \"issuetype\": {"
+ " \"name\": \"RM Deal Ticket\"" + " }"
+ " }" + "}";

HttpURLConnection conn = (HttpURLConnection) jiraREST_URL.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
String encodedData = myvar;
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Basic xxxxxxxxxxxxxxxxxxxxxxx=");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Content-Length", String.valueOf(encodedData.length()));
conn.getOutputStream().write(encodedData.getBytes());

System.out.println(conn.getResponseCode()+" response code");

BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String outputJson="";
String output;
while ((output = in.readLine()) != null) {
outputJson=outputJson+output;
}
System.out.println("Response: "+outputJson);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

}
}

 

Can any one help me on this, I am trying to resolve this issue from long time. 

1 comment

I suspect your Java 6 application is trying to use SSL protocols that Java 8 does not support.  Java 8 (and 7) dropped support for protocols that are broken.

You should read more of the error you got, because it should tell you what the error is, and I'd expect it to say protocols.  If it doesn't tell you, then increase the ssl logging to see if you can get more out of the error message.

Assuming it is protocols, then:

  • You could try the flags that re-enable the protocols in Java 8, but there's no saying that applications will accept that and also support them (good ones won't, because you should not use broken protocols)
  • A better option is to disable the protocols in Java 6.
  • The correct option is to move to a more secure version of Java ("Upgrade is not possible for now" is the wrong attitude).

Comment

Log in or Sign up to comment
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Keough
Published 5 hours ago in Training & Certification

The Project Administration in Jira Server Certification is here!

The Atlassian Certification you've been waiting for is here for good. We're thrilled to announce the official launch of our new Certification for Project Administration in Jira Server! The offering ...

48 views 0 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you