Unable to scan file using sonar lint


My Setup

  • Operating system: Windows 10
  • SonarLint plugin version:
  • Programming language you’re coding in: Java 11.0.16(Amazon Corretto)
  • Is connected mode used: Yes
    • Connected to SonarCloud or SonarQube (and which version): SonarQube ver
  • Intellij version: IntelliJ IDEA 2022.2.3 (Ultimate Edition) Build #IU-222.4345.14

My Problem:
I am trying to scan files using the sonarlint plugin but the it fails with the following error -

Unable to create symbol table for : '[uri=...]'
java.lang.IllegalArgumentException: Unsupported class file major version 61
	at org.objectweb.asm.ClassReader.<init>(ClassReader.java:195)
	at org.objectweb.asm.ClassReader.<init>(ClassReader.java:176)
	at org.objectweb.asm.ClassReader.<init>(ClassReader.java:162)
	at org.sonar.java.resolve.BytecodeCompleter.loadClass(BytecodeCompleter.java:244)
	at org.sonar.java.resolve.Symbols.<init>(Symbols.java:177)
	at org.sonar.java.resolve.SemanticModel.createFor(SemanticModel.java:59)
	at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:122)
	at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:90)
	at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:67)
	at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:115)
	at org.sonar.java.JavaSquid.scan(JavaSquid.java:109)
	at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:88)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:75)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.execute(SensorsExecutor.java:66)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:122)
	at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.startComponents(SpringComponentContainer.java:182)
	at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.execute(SpringComponentContainer.java:161)
	at org.sonarsource.sonarlint.core.analysis.container.module.ModuleContainer.analyze(ModuleContainer.java:71)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:58)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:32)
	at org.sonarsource.sonarlint.core.analysis.AnalysisEngine$AsyncCommand.execute(AnalysisEngine.java:153)
	at org.sonarsource.sonarlint.core.analysis.AnalysisEngine.executeQueuedCommands(AnalysisEngine.java:71)
	at java.base/java.lang.Thread.run(Thread.java:833)

I do not have jdk 17 installed and the major version of the class files after decompiling and grepping is 55.

Can somebody help me resolve this?


1 Like

Hi @Ronnie_Horo

As you guessed, the error indicates that one of the .class our Java analyzer is trying to load had been compiled with a target to Java 17.
This is not necessarily the .class of the file currently analyzed, but it can be any dependency in the classpath passed to the analyzer (so .class inside jars).

In connected mode, SonarLint will take the same analyzer as the SonarQube server, and you are currently on a quite old version of SonarQube. Updating SonarQube would fix your problem since the Java analyzer would support more recent version of Java.

Hi @Julien_HENRY
Thanks for replying.
The uri pointed to a file that was compiled by the jdk configured in the local so I was assuming the error was related to it.
But I am not sure if this would help as I am the only one facing the issue in the team.
I’ll keep you posted.

Thanks again

Hi @Julien_HENRY
I was able to resolve it by downgrading my Intellij.
I am currently at
Intellij: 2021.3.3
Is there a resource which I can refer to for checking the Java, SonarQube, SonarLint and Intellij version compatibility?

Hi @Julien_HENRY
Is there a dependency on the IDE?
As I mentioned, I was not facing the issue when I downgraded my Intellij version.


Hi @Ronnie_Horo

The only reason why changing IntelliJ version would have an effect would be if you compile your project using embedded JBR. Starting from IntelliJ 2022.2, Intellij is started with JBR 17.
But normally you should configure an external JDK to compile your project.

I’ve got the same problem with a java application in openjdk 11, but the plugin takes the intellij java runtime version (aka java 17) instead of the one configured on the menu File / Project structure / Project - SDK

So it’s fail in the logs with :
java.lang.IllegalArgumentException: Unsupported class file major version 61

Intellij version : IDEA 2022.3.2 (Ultimate Edition)
SonarLint plugin version :
Sonar server version : Community Edition Version 7.9 (build 26994)