我正在
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
我尝试过的事情: 1.将证书添加到我的密钥库 2.使用自定义TrustModifier进行验证。这会导致SSL错误更改为http 401错误
这是我的代码
URL website = new URL(urlpath);
HttpURLConnection conn = (HttpURLConnection) website.openConnection();
conn.setRequestMethod("GET");
//TrustModifier.relaxHostChecking(conn);
InputStream is = conn.getInputStream();
FileOutputStream out = new FileOutputStream(path);
copyStream (is, out);
out.close();