Sonar scanner not working after upgrade sonarqube from 9 to 10.6

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) => Sonarqube (10.6) , scanner ( sonar-codescan-plugin-24.1.0.jar)
  • how is SonarQube deployed: , Helm

Yesterday we upgraded the sonarqube from 9 to 10.6 After the upgrade we started facing the issue , please find the below errors , Could someone have idea on that ? what is going on

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Trying to find a local install of the SonarScanner: /root/.sonar/native-sonar-scanner/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner

ERROR: Error during SonarScanner execution
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.sonarsource.scanner.api.internal.IsolatedClassloader@40ef3420-org.sonar.scanner.bootstrap.ScannerPluginRepository’: Initialization of bean failed; nested exception is java.lang.NullPointerException: Cannot invoke “org.sonar.core.platform.ExplodedPlugin.getPluginInfo()” because the return value of “java.util.Map.get(Object)” is null
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:929)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:225)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: java.lang.NullPointerException: Cannot invoke “org.sonar.core.platform.ExplodedPlugin.getPluginInfo()” because the return value of “java.util.Map.get(Object)” is null
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Take a look here.

If the issue is with a specific third-party plugin, you’ll need to reach out to the vendor.

When it will get fixed for maven , because the sonarscan is not working as expected for Maeven Jobs

But some users are still failing with the error , what would be the reason maybe ?

java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

I think that you need to take a look at the upgrade notes, which covered both your initial question, and your new one

End of support of Java 11 as scanner environment

Java 11 is no longer supported as a scanner runtime environment. The minimum required version is Java 17. See the requirements for more information. (SONAR-21157)

Dsonar.login=“${SONAR_LOGIN}” -Dsonar.pullrequest.key=“${BUILD_TAG}” -Dsonar.pullrequest.branch=“${BRANCH_NAME}” -Dsonar.pullrequest.base=master
r
[11:55:05] Starting analysis…
[11:55:05] Checking if executable exists: /home/jenkins/.sonar/native-sonar-scanner/sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner
[11:55:05] Could not find executable in “/home/jenkins/.sonar/native-sonar-scanner”.
[11:55:05] Proceed with download of the platform binaries for SonarScanner…
[11:55:05] Creating /home/jenkins/.sonar/native-sonar-scanner
[11:55:05] Downloading from https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip

INFO: Scanner configuration file: /home/jenkins/.sonar/native-sonar-scanner/sonar-scanner-4.7.0.2747-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/jenkins/agent/workspace/CI_common-tools_React_UI_MR-431/sonar-project.properties
INFO: SonarScanner 4.7.0.2747
INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
INFO: Linux 6.1.100+ amd64
13:55:09 INFO: User cache: /home/jenkins/.sonar/cache
INFO: Scanner configuration file: /home/jenkins/.sonar/native-sonar-scanner/sonar-scanner-4.7.0.2747-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/jenkins/agent/workspace/CI_common-tools_React_UI_MR-431/sonar-project.properties
INFO: Analyzing on SonarQube server 10.6.0.92116
INFO: Default locale: “en”, source code encoding: “UTF-8”
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1.722s
INFO: Final Memory: 4M/17M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
error Command failed with exit code 1.
info Visit yarn run | Yarn for documentation about this command.
error Command failed with exit code 1.
info Visit yarn run | Yarn for documentation about this command.
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Publish)
Stage “Publish” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Storybook image build)
Stage “Storybook image build” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Storybook deploy)
Stage “Storybook deploy” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Storybook deploy (PROD))
Stage “Storybook deploy (PROD)” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
[GitLab Pipeline Status] Notifying merge request build status: FAILED CI/common-tools/React UI/MR-431 #5: There was a failure building this commit.
[GitLab Pipeline Status] Notified
Finished: FAILURE

Okay, where would you like to update the minimum Java version? We are using Docker images to run the Jenkins pipeline (I looked inside the Docker image, and there is no Java is running inside)…

You can update the version of the SonarScanner used in your pipeline here (click Other). I suggest choosing the latest, which will use Java 17 by default.

Thank you very much for your reply , but in our pipeline sonarscanner => 4.7.0.2747 , is already installed , I will check the pipeline version of JRE

Well your pipeline appears to be using 4.7. I suggest that you upgrade it to use 6.2.1.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.