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

前端 未结 10 2225
野的像风
野的像风 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:26

    (repost from my other response)
    Use cli utility keytool from java software distribution for import (and trust!) needed certificates

    Sample:

    1. From cli change dir to jre\bin

    2. Check keystore (file found in jre\bin directory)
      keytool -list -keystore ..\lib\security\cacerts
      Password is changeit

    3. Download and save all certificates in chain from needed server.

    4. Add certificates (before need to remove "read-only" attribute on file "..\lib\security\cacerts"), run: keytool -alias REPLACE_TO_ANY_UNIQ_NAME -import -keystore ..\lib\security\cacerts -file "r:\root.crt"

    accidentally I found such a simple tip. Other solutions require the use of InstallCert.Java and JDK

    source: http://www.java-samples.com/showtutorial.php?tutorialid=210

提交回复
热议问题