尝试使用代码下载https://writing.kemitchell.com/2016/09/21/MIT-License-Line-by-Line.html:
Source.fromURL("https://writing.kemitchell.com/2016/09/21/MIT-License-Line-by-Line.html", "ISO-8859-1").mkString
抛出异常:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
从阅读Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target开始,问题是由我使用自签名证书引起的。
如果我使用命令行工具下载文件,例如' wget' :
wget https://writing.kemitchell.com/2016/09/21/MIT-License-Line-by-Line.html the
页面成功下载。
' wget'使用由操作系统使用和更新的证书?
为什么我可以使用' wget'但不使用JDK?