2

I tried to run the example of openai-java, but SSLHandshakeException error happens.

here is my code my code for this example

java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:45) at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:91) at io.reactivex.Single.blockingGet(Single.java:2585) at com.theokanning.openai.OpenAiService.createCompletion(OpenAiService.java:116)

Also, I used postman to send post requests to https://api.openai.com/v1/completions with my secret-key, it gives "You exceeded your current quota, please check your plan and billing details"

I guess it may because of https Certificate, and I followed How to Resolve Error message "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target", and put certificate of https://openai.com/ into my JDK. And It doesn't work. I wanna ask how to fix this problem

1
  • Same error: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "api.openai.com/v1/embeddings": PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target I tried importing the certificate to cacert and also disable ssl verification: Alias name: openai Creation date: 03-Jul-2024 Entry type: trustedCertEntry ..................... SubjectAlternativeName [ DNSName: api.openai.com ] System.setProperty("com.sun.net.ssl.checkRevocation", "false"); Commented Jul 3, 2024 at 1:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.