PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target;
I am working on a REST call from my windows development machine.
I have tried following the guidelines for adding a certificate in my java keystore in: "C:\Program Files (x86)\Java\jre1.8.0_271\lib\security\cacerts"
Infact I have another JAVA directory in: C:\Program Files\Java\jre1.8.0_271\lib\security\cacerts
I have tried storing my certificate in both keystores.
At the site, that is exposing a rest service, I save the certificate from my Google Chrome webbrowser
...and under the details tab clicking on the "Copy to file" button.
I use the Certificate Export Wizard and pick the first "DER encoded binary x.509 (.CER)" option.
I give the certificate a name "mycert.cer". Once I have it exported, I use the keytool command and add it to my JAVA keystore with the following command:
keytool -import -noprompt -trustcacerts -alias mycert -file "d:\MyCertificates\mycert.cer" -keystore "C:\Program Files (x86)\Java\jre1.8.0_271\lib\security\cacerts" -storepass changeit
I get a confirmation, that it is stored.
I try to invoke my a rest call and I get the same error. Can someone please clarify, what I need to do more? What am I missing?
I am doing all this in admin mode (local adminstrator) on my developer machine.