openai-java icon indicating copy to clipboard operation
openai-java copied to clipboard

sun.security.validator.ValidatorException: PKIX path building failed

Open qianyx opened this issue 1 year ago • 11 comments

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

qianyx avatar Mar 06 '23 10:03 qianyx

我也是这个问题

202252197 avatar Mar 06 '23 14:03 202252197

Just checking to see if related to a diff problem. Please post results of:

java --version

cryptoapebot avatar Mar 06 '23 14:03 cryptoapebot

This problem is caused by the Java environment without HTTPS website certificate, but I don't know how to solve it. I have tried many online solutions but still can't solve it

202252197 avatar Mar 07 '23 00:03 202252197

java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

qianyx avatar Mar 07 '23 01:03 qianyx

Upgrade to java11 , solve the problem

qianyx avatar Mar 07 '23 02:03 qianyx

To use 1.8.0_100 or less you have to use the keytool to upgrade the certs which is complicated and not secure. Upgrading java will fix your issue. Thanks @qianyx !

cryptoapebot avatar Mar 07 '23 03:03 cryptoapebot

######(中文)最简单的办法####### 我分享个我的cacerts文件给大家吧 https://wwym.lanzoum.com/iM6ZU0pjc1eh 下载解压,然后替换 路劲为:

Windows Your Path/jdk1.8.0_91\jre\lib\security
Linux Your Path/jdk1.8.0_45/jre/lib/security

####(English)A piece of cake##### I share my cacerts file here https://wwym.lanzoum.com/iM6ZU0pjc1eh Please uncompress the file and replace to yours For windows Your Path/jdk1.8.0_91\jre\lib\security
For linux Your Path/jdk1.8.0_45/jre/lib/security

haoning7788 avatar Mar 07 '23 09:03 haoning7788

That will work too, but just be aware JDK1.8.0_202 - 361 have multiple security fixes, not just updated certs. You should upgrade to at least JDK 11 or even the latest JDK 19 if you are doing development.

cryptoapebot avatar Mar 07 '23 14:03 cryptoapebot

#######(中文)最简单的办法##### 我分享个我的cacerts文件给大家吧 https://wwym.lanzoum.com/iM6ZU0pjc1eh 下载解压,然后替换 路劲为:

Windows Your Path/jdk1.8.0_91\jre\lib\security Linux Your Path/jdk1.8.0_45/jre/lib/security

####(英语)小菜一碟##### 我在这里分享我的 cacerts 文件 https://wwym.lanzoum.com/iM6ZU0pjc1eh 请解压缩文件并替换为您的文件 对于窗口 您的路径/jdk1.8.0_91\jre\lib\security 对于 linux 您的路径/jdk1.8.0_45/jre/lib/security

为什么我替换了这个文件也不行,1.8和11都试了我想不明白

202252197 avatar Mar 09 '23 02:03 202252197

Sometimes your runtime or JRE is different than the jdk directory. For instance, on my linux machine, it's located in /usr/lib/jvm/default-java/lib/security and conf/security. If you update the certs, you might have to update the conf file too. If you have having trouble replacing the file from permissions, make sure it isn't being used by any applications and restart everything. You don't have to install the certs using jdk11. You should just reinstall JDK1.8.0_361 or JDK19. While @202252197 is being very helpful, installing 3rd party certs is in general not a good practice.

cryptoapebot avatar Mar 09 '23 14:03 cryptoapebot

I ran into this today, machine used has not been used for a week and a half. Program worked prior, now today I am getting this.

Not sure if capacity related (It's at capacity as of writing). Happy to provide more info, just not sure what's changed in the past week or two. (On the side of ChatGPT/this library)

LunarLaurus avatar Mar 20 '23 09:03 LunarLaurus

i sovle this problem by update jdk1.8.0_65 to jdk1.8.0_151 . https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html#license-lightbox

zhongguogu avatar May 24 '23 06:05 zhongguogu