Sonar scanner gradle plugin fails with error Unsupported class file major version 61

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    → gradle 8.2.1
    → org.sonarqube version 4.3.1.3277
    → Java 17
  • how is SonarQube deployed: zip, Docker, Helm
    → external server
  • what are you trying to achieve
    → Run sonar in order to analyze the project
  • what have you tried so far to achieve this
    → I can build the project but can not run the sonar scan task and it throws the error
Unable to create symbol table for : 'src/main/java/com/abc/ServiceImpl.java'
java.lang.IllegalArgumentException: Unsupported class file major version 61

Is there anything else I need to configure to scan my project?

Hi,

Welcome to the community!

This isn’t the version of SonarQube; you’ll find that in your page footer.

This is Java’s painfully obscure way of telling you you have a version mismatch between what you’re trying to run and the version of Java you’re trying to run it with. I keep this SO post bookmarked. It decodes the numbers in those error messages into human-readable Java versions, and it confirms that you are using Java 17. So it’s quite likely that you’re using an EOL version of SonarQube.

 
HTH,
Ann