This article should help if you encounter the following error and accompanying stack trace:
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException:
PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target.
This problem occurs when your Java environment does not trust the certificate of the server running your SonarQube instance. To alleviate this issue, we need to add the server certificate to the Java key store following these steps.
You will need Java keytool, and the location of your CACERTS file. These are typically located in your JRE or JDK such as this:
./jdk1.6.0_24/jre/lib/security/cacerts
./jdk-11.0.9/bin/keytool.exe
Navigate to your server in Chrome > click the padlock on the left of address bar > Click Certificate
Certification Path > select the root certificate > View Certificate
Details > Copy to File
Select DER encoding and download
In an administrative command prompt, navigate to the directory with your downloaded cert and add the certification to your CACERTS using the keytool (keep in mind the directory syntax will change depending on your OS).
keytool -import -alias MyCert -keystore "C:\Program Files\Java\jdk-11.0.9\lib\security\cacerts" -file cert.cer