URLConnection(java.net.URLConnection)请求不信任或配置错误的https站点

有时可能通过URLConnection写了个爬虫收集网站信息,请求https的url时,可能预到javax.net.ssl.SSLException: Not trusted server certificate 、java.security.cert.CertificateException: No subject alternative DNS name matching [hostname] found或javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name这几种异常。本文主要介绍针对这几种异常解决方法。

原文地址:URLConnection(java.net.URLConnection)请求不信任或配置错误的https站点

posted @ 2021-05-20 19:52  levizhong  阅读(300)  评论(0)    收藏  举报