0

I am using GCP Vision API since almost last 3 years and till few days before it was working correctly. But since last couple of days, I started getting below error.

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

Not sure why its failing. Need help to resolve it. Have valid Billing account and OAuth credentials 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();

Getting above mentioned error on last line.

NGR
  • 1,230
  • 2
  • 15
  • 44
  • I think your question is answered here https://stackoverflow.com/questions/21076179/pkix-path-building-failed-and-unable-to-find-valid-certification-path-to-requ – Paddy Popeye Feb 13 '20 at 09:33
  • Does this answer your question? ["PKIX path building failed" and "unable to find valid certification path to requested target"](https://stackoverflow.com/questions/21076179/pkix-path-building-failed-and-unable-to-find-valid-certification-path-to-requ) – Paddy Popeye Feb 13 '20 at 09:33
  • GCP Vision API provides OAuth file in JSON format and I have manually loaded that file while creating a Vision object. I don't have any cert file. – NGR Feb 14 '20 at 05:18

1 Answers1

0

The error is one related to SSL. It means that Java tried to open an SSL connection but was unable to find a chain of certificates validating the Google server's certificate. This isn't a Cloud Vision specific issue.

Google manages its own certificate authority for Google websites and services. The necessary root certificates you need to trust to access Google services can be retrieved from https://pki.goog/roots.pem

Can you ensure that all of those root certificates are installed in your certificate truststore?

Does the issue occur if you call other Google APIs in the same way you're calling the Cloud Vision API?

Are your devices behind any proxies or firewalls that might interfere with establishing SSL connections? Are there any personal firewalls, network equipment, or software that might be blocking this traffic? In particular, port 443 must be enabled for SSL-encrypted traffic.

Can you reproduce the issue on other devices? Or on devices connected to different networks?

Is the system clock on the requesting computer set properly? If the clock is off, the computer may mistakenly think that a certificate is expired or invalid.

Can you use the Google API Explorer to verify that the Cloud Vision API is working for members of your domain? For example, anyone in your domain with Cloud Vision turned should be able to follow this link https://cloud.google.com/vision/docs/drag-and-drop, and test the API.

Paddy Popeye
  • 1,634
  • 1
  • 16
  • 29