SonarQube Scanner execution

Hello Team,

We are facing an issue when we run below commands in code pipeline.

17:58:39.118 ERROR: Error during SonarQube Scanner execution
960 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)

[Container] 2023/05/28 17:58:39 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: sonar-scanner -Dsonar.login=$SONAR_LOGIN -X. Reason: exit status 1

Commands which we are using in the code pipeline:-

We have also tried with changing sonar scanner cli to (sonar-scanner-cli-4.8.0.2856-linux.zip)

After changing CLI we are getting new error like below:-

[Container] 2023/05/29 11:06:02 Running command sonar-scanner -Dsonar.login=$SONAR_LOGIN -X
984 /codebuild/output/tmp/script.sh: 4: /codebuild/output/tmp/script.sh: sonar-scanner: not found

[Container] 2023/05/29 11:06:02 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: sonar-scanner -Dsonar.login=$SONAR_LOGIN -X. Reason: exit status 127

Hi,

The error from your first post is Java’s painfully obscure way of telling you that the Java version you’re trying run the program with is too low. You don’t mention what version of the server you’re running, but you should upgrade Java on your build agent, probably to at least Java 11.

 
HTH,
Ann