91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何解決JDK安全證書錯誤消息No subject alternative names present問題

發布時間:2021-12-17 13:55:09 來源:億速云 閱讀:2895 作者:小新 欄目:大數據

小編給大家分享一下如何解決JDK安全證書錯誤消息No subject alternative names present問題,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

我使用Java消費某網站一個Restful API時,遇到這個錯誤:

21:31:16.383 [main] DEBUG org.springframework.web.client.RestTemplate - Created GET request for " https://127.0.0.1:5031/commerce/product"
21:31:16.388 [main] DEBUG org.springframework.web.client.RestTemplate - Setting request Accept header to [text/plain, application/json, application/*+json, /]
Exception in thread "main" org.springframework.web.client.ResourceAccessException: I/O error on GET request for " https://127.0.0.1:5031/commerce/product": java.security.cert.CertificateException: No subject alternative names present; nested exception is  javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:673)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:620)
at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:319)
at com.sap.prolikeService.service.impl.CommerceProductService.getProductDetailByID(CommerceProductService.java:23)
at com.sap.prolikeService.sandbox.SandboxTest.getProductDetailTest(SandboxTest.java:45)
at com.sap.prolikeService.sandbox.SandboxTest.main(SandboxTest.java:49)
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1506)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
at  sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at  sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at  sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:78)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:659)
... 5 more
Caused by: java.security.cert.CertificateException: No subject alternative names present
at sun.security.util.HostnameChecker.matchIP(HostnameChecker.java:144)
at sun.security.util.HostnameChecker.match(HostnameChecker.java:93)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:455)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:436)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:200)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1488)
... 19 more

錯誤的核心就一句:No subject alternative names present

如何解決JDK安全證書錯誤消息No subject alternative names present問題

解決方案:重新生成證書,將缺失的IP地址包含在證書的extension部分即可。命令行如下:

keytool -genkey -alias tomcat2 -keyalg RSA -keystore ./jerry2.keystore -ext SAN=dns:test.abc.com,ip:127.0.0.1

證書生成后,在Subject Alternative names區域能看到IP地址:

如何解決JDK安全證書錯誤消息No subject alternative names present問題

之后原始的錯誤就消失了:

如何解決JDK安全證書錯誤消息No subject alternative names present問題

以上是“如何解決JDK安全證書錯誤消息No subject alternative names present問題”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

jdk
AI

罗平县| 韶山市| 汶上县| 云浮市| 平潭县| 文昌市| 霍州市| 巴里| 榆社县| 克东县| 济宁市| 白河县| 东台市| 靖江市| 互助| 乌审旗| 镇远县| 龙井市| 财经| 北碚区| 久治县| 淳安县| 六枝特区| 铁岭市| 叙永县| 东光县| 高州市| 循化| 廉江市| 兴业县| 石嘴山市| 紫云| 朝阳区| 青海省| 临沧市| 靖边县| 奎屯市| 林周县| 南雄市| 佳木斯市| 三都|