Unable to find valid certification path to requested target – error even after cert imported

I have a Java client trying to access a server with a self-signed certificate.

When I try to Post to the server, I get the following error:

unable to find valid certification path to requested target

Having done some research on the issue, I then did the following.

  1. Saved my servers domain name as a root.cer file.
  2. In my Glassfish server’s JRE, I ran this:
    keytool -import -alias example -keystore cacerts -file root.cer
  3. To check the cert was added to my cacert successfully, I did this:
    keytool -list -v -keystore cacerts
    I can see the cert is present.
  4. I then restarted Glassfish and retired the ‘post’.

I am still getting thesame error.

I have a feeling this is because my Glassfish is not actually reading the cacert file that I have amended but maybe some other one.

Have any of you had this issue and can push me in the right direction?

16 Answers
16

Leave a Comment