##[Error] Java.lang.UnsupportedClassVersionError

Hi everyone,

I’m new using Sonarqube so I’m not an expert. I have an Integration between SonarQube and Azure Devops Pipelines, now, when I run the Pipeline I’m getting this message when the Run Code Analysis begin:
“ERROR: Error during SonarScanner execution INFO: ##[error]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”.

I set these values in the wrapper config file, but the error persist:
wrapper.java.command=/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64/bin/java
#wrapper.java.command=java

Notes:
I have Sonarqube Community Edition v9.0.1 (build 46107) installed on Centos 8.

I was checking the Sonarqube’s docs but I don’t know how to solve this. I’d really appreciate if someone could explain what changes I need to make to the system or what kind of variables I have to set.

Thank you and my best regards!

Hi,

Welcome to the community!

A UnsupportedClassVersionError is always about the Java program (in this case the scanner) not being compatible with the underlying JRE/JDK version you’re trying to use. In this case it’s saying the java version is too new. When I look up what 52.0 translates to in normal language, I see that it’s Java 8. That tells me you’re using a rather old version of the scanner. You need to upgrade that, although I can’t give you precise instructions for that in the Azure context. The docs may help.

Regarding the wrapper config file, that’s about the SonarQube server itself and not relevant in this context.

 
HTH,
Ann

Hi Ann,
Thanks for your reply. I was checking the docs and I applied some configurations but the error persist. I’ll try to install an older version of sonarqube like 8.9 LTS and see what happens.

Regards,

Hi,

This is not about installing an older version of SonarQube. It’s about using the newest scanner version and making sure you have the correct version of Java to support it.

 
Ann

I am also having same error with sonar version 9.3. If anyone have got the solution, please share detail

Hi @sanjeev2281,

What did you make of my previous answers in the thread?

 
Ann