开发手册 欢迎您!
软件开发者资料库

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这几种异常。本文主要介绍针对这几种异常解决方法。
服务数据出错!