Error SonarQube server can not be reached and PKIX path building failed

we have sonar for multiple services however the below issue is happening only for one service ,please do the needful.

ERROR: SonarQube server [https://xx.xxx] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.447s
INFO: Final Memory: 4M/24M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to execute SonarQube
ERROR: Caused by: Fail to get bootstrap index from server
ERROR: Caused by: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path

Hey there.

It looks like the scanner isn’t able to trust the certificate installed on your SonarQube server (which allows your SonarQube server to be served over HTTPS).

Is there anything different about this environment than the ones in which your other analyses are running? Different built agents, different versions of Java installed…

Specifically, you might start by comparing the environment information provided by the start of the scanner logs (in debug mode, sonar-scanner -X

08:59:43.128 INFO: SonarScanner 4.7.0.2747
08:59:43.128 INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
08:59:43.128 INFO: Mac OS X 13.1 x86_64
08:59:43.357 DEBUG: keyStore is : 
08:59:43.358 DEBUG: keyStore type is : pkcs12
08:59:43.358 DEBUG: keyStore provider is : 
08:59:43.358 DEBUG: init keystore
08:59:43.358 DEBUG: init keymanager of type SunX509
08:59:43.588 DEBUG: Create: /Users/colin/.sonar/cache
08:59:43.590 INFO: User cache: /Users/colin/.sonar/cache
08:59:43.590 DEBUG: Create: /Users/colin/.sonar/cache/_tmp
08:59:43.595 DEBUG: Extract sonar-scanner-api-batch in temp...
08:59:43.602 DEBUG: Get bootstrap index...
08:59:43.602 DEBUG: Download: http://localhost:9000/batch/index

And please remember to include the information asked for in the template post

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

I am getting the similar issue, I am trying to run sonarqube from Azure DevOps. I am able to run the prepare sonar step successfully. but on the Sonarqube post analyses report step it fails with the same error as above - Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I also tried doing a curl on agent –
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0* Trying 10.231.221.151:443…

  • TCP_NODELAY set
  • Connected to sonarqube.insim.biz (10.231.221.151) port 443 (#0)
  • ALPN, offering h2
  • ALPN, offering http/1.1
  • successfully set certificate verify locations:
  • CAfile: /etc/ssl/certs/ca-certificates.crt

It is able to connect to sonar successfully.

Please suggest

I had a similar problem and that error was sent by the SSL certificates that have to be installed I leave you this link, PKIX path building failed: SunCertPathBuilderException: unable to find valid certification path to requested target (magicmonster.com)

I hope it helps you, you comment that it is only for one service, that service must have a certificate and you have to install it follow the instructions from the link, if you use windows, the path must have quotes “path” and the certificate must be Root.
greetings

3 Likes

this solve my problem. Thanks

I have a similar problem can you explain how do you solved it ?