Java – Erro: SSLHandshakeException: …validator.ValidatorException: PKIX path building failed: …SunCertPathBuilderException: unable to find valid certification path to requested target

error sslhandshake

ERROR: SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.

Solução 1:

URL url = new URL("https://exemplo1");
HttpsURLConnection conn1 = (HttpsURLConnection) url.openConnection();

  conn1.setHostnameVerifier(new HostnameVerifier() {
    public boolean verify(String hostname, SSLSession session) {
      return true;
    }
  });

Solução 2: Continue reading