Jenkins: org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube

using sonar-scanner failed with an ERROR, although Get bootstrap completed successful before:

/opt/sonar-scanner/bin/sonar-scanner -X -Djavax.net.debug="ssl,handshake" -Dsonar.projectKey=project-header-forwarding -Dsonar.projectName=project-header-forwarding -Dsonar.projectVersion=0.0.80 -Dsonar.sourceEncoding=UTF-8 -Dsonar.host.url=http://my-sonarsystem:9000 -Dsonar.projectBaseDir=/home/jenkins-master/workspace/project-header-forwarding_master
11:55:59.205 INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
11:55:59.221 INFO: Project root configuration file: NONE
11:55:59.270 INFO: SonarQube Scanner 2.8
11:55:59.270 INFO: Java 1.8.0_212 Oracle Corporation (64-bit)
11:55:59.270 INFO: Linux 3.10.0-957.12.2.el7.x86_64 amd64
11:55:59.560 DEBUG: keyStore is :
11:55:59.561 DEBUG: keyStore type is : jks
11:55:59.561 DEBUG: keyStore provider is :
11:55:59.561 DEBUG: init keystore
11:55:59.562 DEBUG: init keymanager of type SunX509
11:55:59.665 INFO: User cache: /home/wpci/.sonar/cache
11:55:59.665 DEBUG: Extract sonar-scanner-api-batch in temp...
11:55:59.680 DEBUG: Get bootstrap index...
11:55:59.680 DEBUG: Download: http://my-sonarsystem:9000/batch_bootstrap/index
11:55:59.962 DEBUG: Get bootstrap completed
11:55:59.969 INFO: ------------------------------------------------------------------------
11:55:59.970 INFO: EXECUTION FAILURE
11:55:59.970 INFO: ------------------------------------------------------------------------
11:55:59.971 INFO: Total time: 0.832s
11:56:00.014 INFO: Final Memory: 4M/178M
11:56:00.014 INFO: ------------------------------------------------------------------------
11:56:00.014 ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
    at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
    at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:72)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
    at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:93)
    at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
    at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)
    ... 8 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:87)
    ... 11 more

Hi,

You say this used to work. So what changed in your system or environment? Are there errors in your server logs?

 
Ann

I installed SonarQube for Migration purposes on an other system. After succesful migration (from 5.6.7 to 7.9 and from MySQL to PostgreSQL) I changed the sonar-scanner call in Jenkins to use the new URL ( -Dsonar.host.url=http://my-sonarsystem:9000). I don’t know why this doesn’t work and the error is not clear for me. In the log (pasted in the topic) I see

11:55:59.680 DEBUG: Download: http://my-sonarsystem:9000/batch_bootstrap/index
11:55:59.962 DEBUG: Get bootstrap completed

So, I think connecting to the new system is OK

But I don’t know what the exception

Caused by: java.lang.IllegalStateException: Fail to download libraries from server

means.

Hi,

Perhaps you also need to upgrade your Jenkins plugin? 5.6 (via 6.7) to 7.9 is a big jump and a lot has happened in between. I just double-checked the /batch_bootstrap/index path on our dogfooding server and got a 404, so that makes me suspect a scanner upgrade (or upgrades) is in order.

One thing you could do to help diagnose this is to run an analysis of a dummy project from your local machine. If that succeeds then you have a baseline against which to compare your Jenkins setup.

As a side note, I notice in your log that you use the sonar.projectBaseDir parameter. That shouldn’t be needed; analysis always assumes a base directory of ., which seems to be equivalent to what you’re feeding in to this parameter.

 
HTH,
Ann

Hi Ann, thanks for the hints. The installed Jenkins plugin is the newest. The sonar-scanner is a little bit older :wink: . I updated sonar-scanner to the newest version 4 and the error is gone.

Thank’s so much.