SonarQube server not reachable error

Hello,

Must-share information (formatted with Markdown):

  • Which versions are you using (SonarQube Server / SONAR_SCANNER_VERSION=4.7.0.2747)

  • how is SonarQube deployed: zip

  • Download and unzip the Scanner for Linux

  •         -Dsonar.projectKey=project_key \
            -Dsonar.sources=. \
            -Dsonar.host.url=sonarqube_url \
            -Dsonar.login=project_token \
            -Dsonar.scanner.skipCertificateValidation=true \
            -Dsonar.ws.ssl.verificationMode=none \
    
    
  • Execute the Scanner

sonar-scanner \
  -Dsonar.projectKey=project_key \
  -Dsonar.sources=. \
  -Dsonar.host.url=https://project_url/
  • What are you trying to achieve: connection to sonerqube server through Redhat Openshift.
  • Error:
updating ca trust store
/directory/.sonar/sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner
Running SonarQube Scan...
INFO: Scanner configuration file: /directory/.sonar/sonar-scanner-4.7.0.2747-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.7.0.2747
INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
INFO: Linux 5.14.0-284.86.1.el9_2.x86_64 amd64
INFO: SONAR_SCANNER_OPTS=-server
INFO: User cache: /root/.sonar/cache
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
ERROR: SonarQube server [soner_server_url] cannot be reached
INFO: Total time: 0.858s
INFO: Final Memory: 9M/895M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
  • Application- nodejs, integrating with openshift piplelines, repo on bitbuket
    *The SonarScanner failed to connect to the SonarQube server due to SSL ceertificate validation issues. Used curl with --cacert confirmed that the certification was valid, but SonarScanner still failed. Th certificated is located at /etc/pki/ca-trust/source/anchors/.
    Attempted to add the cert to Java’s default trust store, cert was added successfully. Still the error persists SonarQube Server is not reachable followed with:
    SonarQube Server is not reachable
ERROR: Error during SonarScanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
	at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)
	at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)
	at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
	at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
	... 7 more
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
	at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
	at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)```

Hi,

First, that’s a really old version of the scanner. The current version is 6.2.1. You should upgrade.

Once you’re on a current version of the scanner, the docs should help you get your certificate configured.

 
Ann

1 Like