java.lang.UnsupportedClassVersionError in sonar 9.1 developer version

We are recently upgraded 9.1 developer edition since jenkins getting error below
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 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
both jenkins and sonar container using jdk 11 .
kindly someone help us

Hi,

with Sonarqube 9, Java 11 is required for all scanners.
In your case - even if Jenkins runs with jdk11 - the analysis still uses Java 8 (class file version 52.0), has to be Java 11 (class file version 55.0) instead.

see
https://docs.sonarqube.org/latest/analysis/analysis-with-java-11/

Gilbert

added java home in global tools configuration


getting below error : /home/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonarqube/bin/sonar-scanner
Could not find ‘java’ executable in JAVA_HOME or PATH.

you have to use a Java11 configured via https://somejenkinshost/configureTools/ like that, i.e.

nodejs(configId: '...', nodeJSInstallationName: 'NodeJS 14.15') {
  withSonarQubeEnv(sonarenv) {
    withMaven(jdk: '...', maven: "...", globalMavenSettingsConfig: '...') {
      sh("mvn ... sonar:sonar ${sqProjectVersion ? "-Dsonar.projectVersion=$sqProjectVersion" : ''} -Dsonar.branch.name=$BRANCH_NAME")
    }
  }
}

when sonarenv is your configured Sonarqube server and jdk used within withMaven scope
has to be a jdk 11.
The nodejs block around is optional, but it’s a must when no nodejs on path and you need to
scan also js, typescript or css.