Home > Back-end >  Java 8 No trusted certificate found on HTTPS requests
Java 8 No trusted certificate found on HTTPS requests

Time:09-16

I'm on linux and I need to use a particular version of java 8 (1.8.0_162) can't use OpenJDK either.

But, I'm getting this error when I try to connect / get / download / whatever from my java program on any HTTPS url

sun.security.validator.ValidatorException: No trusted certificate found

I know that the code is right, because its working on production, but I can run the code on my local machine.

I think is something related to certificates, but don't know how to fix.

EDIT: In my lib/security folder I have lots of broken links... Can be that the reason? Where can I get the files?

enter image description here

There is a pic of my security folder. The ones with an X its a broken link. Which should I replace?

CodePudding user response:

There is a file named "cacerts" in the folder %JAVA_JRE_HOME%/lib/security. This is a truststore for your java runtime environment. Use "KeyStore Explorer" (or any other keystore program) to open the file (password 'changeit') and add the certificate to trust.

CodePudding user response:

Ok, I just found the problem and the solution.

The problem was that in my security folder (jre/lib/security) The files inside were broken links to other files that doesn't exists.

I went to the oracle homepage, download a jdk from java 8 linux, and replaced all the files inside the security folder (but no the folder policy).

  • Related