PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求的Okhttp的有效证书路径

时间:2019-03-08 12:00:43

标签: okhttp3

我试图以不安全的方式调用RestEndpoint,但是使用okhttp API来访问该服务。这给了我下面的错误。

OkHttpClient client = new OkHttpClient();

Request okRequest = new Request.Builder()
  .url("https://YYY-servicing-v1-unsecured.apps.pcfdev.X.int/student-api/v1/student/166160?includeIcasAndBins=false")
  .get()
  .addHeader("cache-control", "no-cache")
  .addHeader("postman-token", "6b14c245-142c-4838-ba02-0faadb0ec799")
  .build();

Response okResponse;
try {
    okResponse = client.newCall(okRequest).execute();
    System.out.println("OK RESPONSE = "+okResponse);
} catch (IOException e) {
    System.out.println(e.getMessage());
}

错误:

  

sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到到请求目标的有效认证路径

0 个答案:

没有答案