【问题标题】:GCP: Vision API: Getting certification errorGCP:Vision API:获取认证错误
【发布时间】:2020-05-28 19:01:11
【问题描述】:

我使用 GCP Vision API 几乎过去 3 年,直到它正常工作前几天。 但是从最近几天开始,我开始出现以下错误。

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

不知道为什么会失败。需要帮助来解决它。拥有有效的计费帐户和 OAuth 凭据 json。

AnnotateImageRequest request = new AnnotateImageRequest()
                .setImage(new Image().encodeContent(image))
                .setFeatures(ImmutableList.of(new Feature().setType("LOGO_DETECTION").setMaxResults(MAX_RESULTS),
                                            new Feature().setType("IMAGE_PROPERTIES").setMaxResults(MAX_RESULTS),
                                            new Feature().setType("TEXT_DETECTION").setMaxResults(MAX_RESULTS)));
        Vision.Images.Annotate annotate = vision.images()
                .annotate(new BatchAnnotateImagesRequest().setRequests(ImmutableList.of(request)));

        BatchAnnotateImagesResponse batchResponse = annotate.execute();

在最后一行出现上述错误。

【问题讨论】:

标签: google-cloud-platform google-cloud-vision


【解决方案1】:

该错误与 SSL 有关。这意味着 Java 尝试打开 SSL 连接,但无法找到验证 Google 服务器证书的证书链。这不是 Cloud Vision 特有的问题。

Google 为 Google 网站和服务管理自己的证书颁发机构。可以从以下位置检索您需要信任才能访问 Google 服务的必要根证书 https://pki.goog/roots.pem

您能否确保所有这些根证书都安装在您的证书信任库中?

如果您以与调用 Cloud Vision API 相同的方式调用其他 Google API,是否会出现此问题?

您的设备是否位于任何可能干扰建立 SSL 连接的代理或防火墙后面?是否有任何个人防火墙、网络设备或软件可能会阻止此流量?特别是,必须为 SSL 加密的流量启用端口 443。

您能否在其他设备上重现该问题?还是在连接到不同网络的设备上?

请求计算机上的系统时钟设置是否正确?如果时钟关闭,计算机可能会误认为证书已过期或无效。

您能否使用 Google API Explorer 来验证 Cloud Vision API 是否适用于您的域成员? 例如,您域中启用 Cloud Vision 的任何人都应该能够点击此链接 https://cloud.google.com/vision/docs/drag-and-drop,并测试 API。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-04-19
    • 1970-01-01
    • 1970-01-01
    • 2017-05-17
    • 2012-11-24
    • 2021-07-21
    • 2018-02-08
    相关资源
    最近更新 更多