阅读背景:

PKIX: unable to find valid certification path to requested target

来源:互联网 
// Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return new java.security.cert.X509Certificate[]{}; } public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } } }; try { SSLContext context = SSLContext.getInstance("TLS"); context.init(null, trustAllCerts, new java.security.SecureRandom()); // ... 使用 context 获取 SSLSocketFactory } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } catch (KeyManagementException e) { throw new IllegalStateException(e); } // Create a trust manager that does not validat



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: