SonarQube Java Runtime error while analysis

Hello Team,

We have below configuration,
Docker image of sonarqube
SonarQube Community Edition : Version 9.6.1 (build 59531)
As a prerequisite java 11 is installed,
Java version 11 : openjdk 11.0.16 2022-07-19 LTS,
As suggested in Prerequisites and Overview | SonarQube Docs
We tried to analyze for python and java source code but for both getting below error

06:09:28.934 DEBUG: Execution execute
06:09:28.936 INFO: ------------------------------------------------------------------------
06:09:28.936 INFO: EXECUTION FAILURE
06:09:28.936 INFO: ------------------------------------------------------------------------
06:09:28.937 INFO: Total time: 0.532s
06:09:28.982 INFO: Final Memory: 4M/115M
06:09:28.986 INFO: ------------------------------------------------------------------------
06:09:28.986 ERROR: Error during SonarQube Scanner execution
java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Kindly let me know if you need any information

Thanks for your support

Thanks and Regards,
Dhanush

Hey there.

Take a look at the documentation on Scanner Environment – specifically making sure that at least Java 11 is being used to run the analysis. Your JAVA_HOME environment variable will need to point to your Java 11 installation (try running java -version where you’re running analysis and see what’s returned).

Hello Colin,

Thanks for the suggestion

I have tried both results are like below,
[root@localhost test2]# java --version
openjdk 11.0.16.1 2022-08-12 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.16.1.1-3.el9) (build 11.0.16.1+1-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.16.1.1-3.el9) (build 11.0.16.1+1-LTS, mixed mode, sharing)

[root@localhost test2]# echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-11.0.16.1.1-3.el9.x86_64

Both are pointing to Java 11 itself
But still getting,
ERROR: Error during SonarQube Scanner execution
java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Please help on this

Thanks and Regards,
Dhanush

Which version/flavor of the SonarScanner are you using?

Hello Colin,

Thanks a lot for you support,
As you guessed there was some problem in the sonascanner that I was using earlier,
Now with new official sonarscanner, This issue is resolved

Regards,
Dhanush

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