java - 错误 : SSLHandshakeException

标签 java ssl ssl-certificate

<分区>

需要帮助。最近我们的 rundeck 服务器在 HTTP 上运行并将其更改为 HTTPS,并且基于 Java 的应用程序之一正在连接到它。当我将 Java 应用程序的属性更改为 HTTPS 时,出现错误

 [ERROR] HttpJobFactory - Error encountered while processing request
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1914)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:279)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:273)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1472)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:213)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:913)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:849)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1033)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1342)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1369)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1353)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)

不过,我已经在/usr/lib/jvm/jre/lib/security/cacerts 下添加了 rundeck 证书。

这是我使用的语法;

keytool -import -v -trustcacerts -alias <your domain> -file ~/<your domain>.crt -keystore <JAVA HOME>/jre/lib/security/cacerts -keypass changeit -storepass changeit

我的引用:Resolving javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed Error?

最佳答案

解决了问题!!通过添加所有 lets'encrypt 证书并对其进行交叉签名

关于java - 错误 : SSLHandshakeException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45183737/

上一篇:node.js - 主页未解析裸域 URL

下一篇:url - 错误域的隐私错误

相关文章:

Java - 编辑图像

ssl - Cassandra C# TLS 版本选择?

security - 购买 SSL 证书时,它会自动附带根证书和中间证书吗?

ssl - AWS 上的 Chef : How do you update the certificate on the server?

java - 如何建立到 mail.google.com 的单向 SSL 连接?

scala - 如何在 Play Framework 上配置 ssl 证书?

ssl - 嵌入式网络服务器和证书

java - 创建数组对象和用花括号分配数组有什么区别?

java - 使用 java 套接字向多个客户端传输大文件的最佳方法

java - 尝试将我的数据存储在数组内的文本文件中