Caused by: java.security.cert.CertificateException: No subject alternative names present
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at com.fob.utils.HttpsUtil.httpsServer(HttpsUtil.java:89)
at com.fob.utils.HttpsUtil.httpsPost(HttpsUtil.java:37)
at com.fob.test.Test.httpsTest(Test.java:23)
at com.fob.test.Test.main(Test.java:14)
Caused by: java.security.cert.CertificateException: No subject alternative names present
at sun.security.util.HostnameChecker.matchIP(Unknown Source)
at sun.security.util.HostnameChecker.match(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(Unknown Source)
at sun.security.ssl.AbstractTrustManagerWrapper.checkAdditionalTrust(Unknown Source)
at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(Unknown Source)
... 16 more
【Caused by: java.security.cert.CertificateException: No subject alternative names present】
使用HttpsURLConnection对象,链接本地。
错误原因,因为访问的是内网,改成外网即可,比如: https://www.baidu.com
推荐阅读
- Caused by: android.os.TransactionTooLargeException
- java.security.cert.CertificateException: No name matching IP found
- java.security.cert.CertificateException: No subject alternative names present
- Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format
- Caused|cxf实现的webservice,调用接口的方法后出现异常
- java|Caused by: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamesp
- Caused|Caused by: java.lang.NoSuchMethodError: org.h2.index.BaseIndex: method ()V not found
- Caused by: java.net.BindException: Address already in use: bind