Java Version mismatch during upgrade

Must-share information (formatted with Markdown):

I am upgrading SonarQube from v 9.2.4 to v10 using zip file.

v9 was running on Amazon Linux 2, using Oracle JRE java-11-openjdk-11.0.18.0.10-1.amzn2.0.1.x86_64

SonarQube fails to start with the usual error:

java.lang.UnsupportedClassVersionError: org/sonar/application/App has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

I installed AWS Java Coretto, but get the same error. I tried to explicitly set SONAR_JAVA_PATH, JAVA_HOME, but to no avail.

I saw many posts here about this error; the common thought is that at some point JAVA is losing environment. But I can’t think of any other place where I can put it.

$ java -version
openjdk version "11.0.18" 2023-01-17 LTS
OpenJDK Runtime Environment Corretto-11.0.18.10.1 (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.18.10.1 (build 11.0.18+10-LTS, mixed mode)

the command that gets executed looks correct to me (but I don’t know much about Java):

/opt/sonarqube10/bin/linux-x86-64 $/usr/lib/jvm/java-11-amazon-corretto.x86_64/bin/java -Xms8m -Xmx32m --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -jar ../../lib/sonar-application-10.0.0.68432.jar
Error: LinkageError occurred while loading main class org.sonar.application.App
        java.lang.UnsupportedClassVersionError: org/sonar/application/App has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Version 9 is still working

Thank you

Hey there.

As noted in the requirements and upgrade notes

SonarQube server requires Java 17
Java 17 is required for SonarQube server. Use of Java 11 is no longer supported. See the documentation on prerequisites for more information. (SONAR-17566).

SonarQube server requires Java 17
Java 17 is required for SonarQube server. Use of Java 11 is no longer supported. See the documentation on prerequisites for more information. (SONAR-17566).

So you should expect java -version to return 17.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.