close

[Solved] unable to find a valid certification path to requested target

Hello Guys, How are you all? Hope You all Are Fine. Today I am facing the following error unable to find a valid certification path to requested target in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How unable to find a valid certification path to requested target Error Occurs?

Today I am facing the following error unable to find a valid certification path to requested target in Java.

How To Solve unable to find a valid certification path to requested target Error ?

  1. How To Solve unable to find a valid certification path to requested target Error ?

    To Solve unable to find a valid certification path to requested target Error As you are making an https connection from the client to the server. It is failing in the handshake process because the client needs to validate the server certificate.

  2. unable to find a valid certification path to requested target

    To Solve unable to find a valid certification path to requested target Error As you are making an https connection from the client to the server. It is failing in the handshake process because the client needs to validate the server certificate.

Solution 1

As you are making an https connection from the client to the server. It is failing in the handshake process because the client needs to validate the server certificate. On the client-side, you need the issuer certificate (Root CA) to validate the server certificate. Most of the root certificates are pre-exists in JDK. Root certificates are stored, by default, in a Keystore file called cacerts. Here the server certificate is not issued by the certification authority and the server is either using the self-signed certificate or certificate issued by in house CA. You need to add the Root CA certificate to the java cacerts key store.

You can easily retrieve the Root CA certificate by visiting the server site in the browser. Click on the secure lock pad in the url bar and explore the certificate option. You need to export the Root CA certificate by using the copy option and save the cert file on your system.

Go to the location eg: C:\Program Files\Java\jdk1.8.0_121\jre\lib\security where the cacerts is present and open the command prompt to execute the following command.

keytool -import -alias -aliasName -file pathToRootCA.crt -keystore cacerts

Password is changeit

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read