วันอาทิตย์ที่ 7 กุมภาพันธ์ พ.ศ. 2559

How to fix PKIX path building failed unable to find valid certification path to requested target

1.  get the self-signed certificate from the mail server via openssl:


echo | openssl s_client -connect your_imaps_server:port 2>&1 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > exported_cert.pem


2. Check your current used JRE path, for example in Eclipse
Windows > Preferences > Java > Installed JREs


3. Open cmd as Administrator (for Windows users)


4. Copy file from step 1 into path_from_step2\lib\security


5. Open CMD as Admin (for Windows >> All Programs > Accessories > CMD > Run as admin )




6. Check certs for JRE, CD to path_from_step2\lib\security , run command


keytool -list -keystore cacerts


Password is changeit. The command will list all certs




7. Run command


For Windows>>  keytool -keystore cacerts -importcert -alias mycert -file exported_cert.pem
For Unix>> keytool -keystore cacerts -import -alias mycert -file exported_cert.pem
Password is changeit
If there is error please make sure that you log in as Administrator



ไม่มีความคิดเห็น:

แสดงความคิดเห็น