SonarScanner failed to scan my java and js code after upgrade SonarQube

Hi,

I recently upgrade SonarQube to 8.3.1 but didn’t upgrade Jenkins and now my sonarqube scanner is failing with the following error:

Can I get SonarQube scanner to work without upgrading my jenkins instance? What would be the fix for the below errors?

Is upgrading SonarQube Scanner and upgrade my jenkins the only way to get this to work?

SonarQube version: 8.3.1
SonarQube Scanner: 2.4 (I have an old jenkins instance hence it is a low version)

These are my parameters that I used:
sonar.projectKey=xyz
sonar.projectName=xya
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src/app
sonar.exclusions=* /node_modules/ *
sonar.tests=src/app
sonar.test.inclusions=* / .spec.js
sonar.coverage.exclusions=* / .spec.js
sonar.language=js
sonar.javascript.lcov.reportPaths=coverage/PhantomJS 2.1.1 (Linux 0.0.0)/lcov.info

Error below:

17:15:51** SonarQube Runner 2.4 **
17:15:51** Java 1.8.0_162 Oracle Corporation (64-bit) **
17:15:51** Linux 3.13.0-112-generic amd64 **
17:15:51** INFO: Error stacktraces are turned on. **
17:15:51** INFO: Runner configuration file: /home/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQube_Runner_2.4/conf/sonar-runner.properties **
17:15:51** INFO: Project configuration file: /xyz/sonar-project.properties **
17:15:51** INFO: Default locale: “en_US”, source code encoding: “UTF-8” **
17:15:51** INFO: Work directory: /xyz/.sonar **
17:15:52** INFO: SonarQube Server 8.3.1.34397 **
17:15:52** INFO: ------------------------------------------------------------------------ **
17:15:52** INFO: EXECUTION FAILURE **
17:15:52** INFO: ------------------------------------------------------------------------ **
17:15:52** Total time: 0.478s **
17:15:52** Final Memory: 5M/241M **
17:15:52** INFO: ------------------------------------------------------------------------ **
17:15:52** ERROR: Error during Sonar runner execution **
17:15:52** java.lang.IllegalStateException: Fail to download libraries from server **
17:15:52** at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:78) **
17:15:52** at org.sonar.runner.impl.Jars.download(Jars.java:57) **
17:15:52** at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:46) **
17:15:52** at org.sonar.runner.impl.JarDownloader.checkVersionAndDownload(JarDownloader.java:37) **
17:15:52** at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:71) **
17:15:52** at java.security.AccessController.doPrivileged(Native Method) **
17:15:52** at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) **
17:15:52** at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) **
17:15:52** at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) 17:15:52 at org.sonar.runner.api.Runner.execute(Runner.java:100) **
17:15:52** at org.sonar.runner.Main.executeTask(Main.java:70) **
17:15:52** at org.sonar.runner.Main.execute(Main.java:59) **
17:15:52** at org.sonar.runner.Main.main(Main.java:53) **
17:15:52** Caused by: java.lang.ArrayIndexOutOfBoundsException: 1 **
17:15:52** at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:72) **
17:15:52** … 12 more **
17:15:52** ERROR: **
17:15:52** ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.

Hi, can’t you upgrade your SonarScanner to a more recent version? You don’t necessarily need to upgrade Jenkins.

Thank you. Tried to upgrade SonarScanner to a more recent version but it won’t allow me to upgrade until I upgrade my jenkins to a more recent version.

In that case the only workaround I can think of is to manage the SonarScanner tool yourself. Ideally you’d avoid downloading it every time you run a build so you’d have it installed in your agents.