简体   繁体   English

使用JAVA连接到JIRA REST API的握手失败

[英]Handshake Failure Connecting to JIRA REST API using JAVA

I am trying to write a JAVA program to connect to a JIRA REST API. 我正在尝试编写一个JAVA程序以连接到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 主要,处理异常:javax.net.ssl.SSLHandshakeException:收到致命更改:handshake_failure javax.net.ssl.SSLHandshakeExcepitp:收到致命警报:handshake_failure

I tried openssl to connect to the site URL and that worked. 我试过openssl连接到站点URL,并且有效。 I found this: 我找到了这个:

https://confluence.atlassian.com/fishkb/sslhandshakeexception-received-fatal-alert-handshake_failure-785618218.html 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. 这使我认为Java 1.8无法使用,因此我切换到1.7。 But I got the same error. 但是我遇到了同样的错误。

Appreciate your thoughts. 欣赏你的想法。

Have you tried using Jira Rest Client API? 您是否尝试过使用Jira Rest Client API?

https://github.com/techtalk/JiraRestClient https://github.com/techtalk/JiraRestClient

I have used it and works very well, I would not want to deal with the Apache CloseableHttpClient myself. 我已经使用过它并且效果很好,我自己不想处理Apache CloseableHttpClient。

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. 使用此api非常简单,如果您使用的是maven,它使添加依赖项和使用它变得更加容易,否则,您可以下载jar并将其添加到类路径中,并非常轻松地创建Java客户端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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