Problems with scanner after upgrading server from 9.9 to 10.4

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube=10.4.1, Scanner=4.7.0.2747/5.0.1.3006, JRE=11.0.14.1/17.0.7)

We have been running the latest LTS version for while and have updated to 10.4.1 (latest as of writing this). Our newest runners with the latest scanner still works without problems but we have some old runners that are used for older releases which fails when starting the analysis.
We are using the runner supplied with the analyzer and it worked immediately before the update and failed afterwards.
I don’t understand why the analyzer would fail since it has access to the same JRE as before, which was even supplied with it. Does it download something from the server in the process?

INFO: Scanner configuration file: /opt/sonar-scanner-4.7.0.2747-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/wp-tuc/SICS/SICS/sonar-project.properties
INFO: SonarScanner 4.7.0.2747
INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
INFO: Linux 5.15.0-89-generic amd64
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner-4.7.0.2747-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/wp-tuc/SICS/SICS/sonar-project.properties
INFO: Analyzing on SonarQube server 10.4.1.88267
INFO: Default locale: "en_US", source code encoding: "utf-8"
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.290s
INFO: Final Memory: 4M/40M
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: Re-run SonarScanner using the -X switch to enable full debug logging.

Hey there.

This specific error comes when you’re running Java 11 with SonarQube v10.4.1

Release 10.4 upgrade notes

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 Prerequisites and requirements for more information. (SONAR-21157)

v5.0+ of the scanner comes with Java 17 embedded, so I’d be really surprised if you get the same error when using v5.0.1.

Do you have logs to share from when you’re using Java 17 or the upgraded scanner?

Hi Colin.
When running with the new scanner there are no problems.
But out of curiosity: How does the old scanner suddenly require Java 17 after the upgrade? Is it due to something downloaded from the server?

Best regards
Kristian

Yes. The scanner is ultimately just a way to bootstrap getting the files from the server that has all the logic. That’s where the dependency comes from.

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