简体   繁体   中英

Handshake Failure Connecting to JIRA REST API using JAVA

I am trying to write a JAVA program to connect to a JIRA REST API. I used code similar to this to connect to other services with my certs:

SSLContext sslContext = ReadJira.createSSLContext(<assorted parameters>)
CloseableHttpClient httpClient = httpClients.custom.setSSLContext(sslContext).build();
String test = new String("https:...etc"); 
HttpGet httpGetUrl = new HttpGet(test);
CloseableHttpResponse response = httpClient.execute(httpGetUrl);

I get an error:

main,handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alter: handshake_failure javax.net.ssl.SSLHandshakeExcepitp: Received fatal alert: handshake_failure

I tried openssl to connect to the site URL and that worked. I found this:

https://confluence.atlassian.com/fishkb/sslhandshakeexception-received-fatal-alert-handshake_failure-785618218.html

This made me think Java 1.8 wouldn't work, so I switched to 1.7. But I got the same error.

Appreciate your thoughts.

Have you tried using Jira Rest Client API?

https://github.com/techtalk/JiraRestClient

I have used it and works very well, I would not want to deal with the Apache CloseableHttpClient myself.

Using this api is pretty straight forward, if you are using maven, it makes it even more easier to add the dependency and use it, otherwise, you can download the jar and add it to the classpath and create your java client very easily.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM