以下のコードを実行すると、「要求されたターゲットへの有効な認証パスが見つかりません」という例外が発生します。
String protocol = "https://10.0.100.80/MyAPP/index.html";
java.net.URL obj = new java.net.URL(protocol);
HttpURLConnection httpReq = (HttpURLConnection) obj.openConnection();
httpReq.setDoOutput(true);
httpReq.setInstanceFollowRedirects(true);
httpReq.setRequestMethod("GET");
Date date = new Date();
System.out.println("iStatus: " + httpReq.getResponseMessage());
System.out.println("iCode: " + httpReq.getResponseCode());
例外:
Caused by: sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:323)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:217)
at sun.security.validator.Validator.validate(Validator.java:218)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1185)
... 14 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:318)
... 20 more
SSLが有効になっているURLにpingを実行するのを手伝ってください。