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

前端 未结 10 2053
野的像风
野的像风 2020-11-22 13:12

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:

un

10条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 13:38

    In my case I was facing the problem because in my tomcat process specific keystore was given using

    -Djavax.net.ssl.trustStore=/pathtosomeselfsignedstore/truststore.jks
    

    Wheras I was importing the certificate to the cacert of JRE/lib/security and the changes were not reflecting. Then I did below command where /tmp/cert1.test contains the certificate of the target server

    keytool -import -trustcacerts -keystore /pathtosomeselfsignedstore/truststore.jks -storepass password123 -noprompt -alias rapidssl-myserver -file /tmp/cert1.test
    

    We can double check if the certificate import is successful

    keytool -list -v -keystore /pathtosomeselfsignedstore/truststore.jks
    

    and see if your taget server is found against alias rapidssl-myserver

提交回复
热议问题