Sonarqube server start failed

Hi Sirs,
We are upgrading the Sonarqube server to 10.2.1.78527(latest LTS)
After start the sever, it shows some error:
./sonar.sh console
Running SonarQube…
Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” 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 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:621)

To check JAVA version further, the version is already the newest
java -version
openjdk version “1.8.0_392”
OpenJDK Runtime Environment (build 1.8.0_392-b08)
OpenJDK 64-Bit Server VM (build 25.392-b08, mixed mode)
No idea why Sonarqube cannot run normally?

Thanks.

Hi,

Java 1.8.0_392 ain’t the newest version, Java 21 is the new LTS version since September 19 2023.

Sonarqube 10.x needs to run with Java 17
get it here https://adoptium.net/temurin/releases/?version=17
see Prerequisites and overview

Gilbert

Hi Gilbert,
I have tried to install java 17 by your proposal
But it still failed to run sonarqueb server.
From the console, the error message is similar.
Any idea is welcome, thanks!

sudo ./sonar.sh console
/bin/java
Running SonarQube…
Removed stale pid file: ./SonarQube.pid
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
[fred@ftckvmsp01 linux-x86-64]$ java -version
openjdk version “17.0.9” 2023-10-17
OpenJDK Runtime Environment Temurin-17.0.9+9 (build 17.0.9+9)
OpenJDK 64-Bit Server VM Temurin-17.0.9+9 (build 17.0.9+9, mixed mode, sharing)

Hi Sirs,
I use “alternatives --config java” to switch to the latest JRE installation copy, the server is running, however, some error are threw and stopped at Elasticsearch
“can not run elasticsearch as root”
Could I run Sonarqube using normal user?
Thanks.

sudo ./sonar.sh console
/bin/java
Running SonarQube…
Removed stale pid file: ./SonarQube.pid
2023.10.30 14:10:10 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /export/sonarqube_home/sonarqube-10.2.1.78527/temp
2023.10.30 14:10:10 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:41408]
2023.10.30 14:10:10 INFO app[o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/export/sonarqube_home/sonarqube-10.2.1.78527/elasticsearch]: /usr/lib/jvm/temurin-21-jre/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=/export/sonarqube_home/sonarqube-10.2.1.78527/elasticsearch -Des.path.conf=/export/sonarqube_home/sonarqube-10.2.1.78527/temp/conf/es -Des.distribution.type=tar -cp /export/sonarqube_home/sonarqube-10.2.1.78527/elasticsearch/lib/:/export/sonarqube_home/sonarqube-10.2.1.78527/elasticsearch/lib/cli-launcher/ org.elasticsearch.launcher.CliToolLauncher
2023.10.30 14:10:10 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
Oct 30, 2023 2:10:13 PM sun.util.locale.provider.LocaleProviderAdapter
WARNING: COMPAT locale provider will be removed in a future release
2023.10.30 14:10:14 ERROR es[o.e.b.Elasticsearch] fatal exception while booting Elasticsearch
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.initializeNatives(Elasticsearch.java:262) ~[elasticsearch-8.7.0.jar:?]
at org.elasticsearch.bootstrap.Elasticsearch.initPhase2(Elasticsearch.java:161) ~[elasticsearch-8.7.0.jar:?]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:66) ~[elasticsearch-8.7.0.jar:?]
ERROR: Elasticsearch did not exit normally - check the logs at /export/sonarqube_home/sonarqube-10.2.1.78527/logs/sonarqube.log

ERROR: Elasticsearch exited unexpectedly
2023.10.30 14:10:14 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2023.10.30 14:10:14 INFO app[o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.10.30 14:10:14 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped

Hi Gilbert,
I found the solution and just chown of new sonarqube folder and switch user to sonar
#chown sonar -R sonarqube_folder
#su sonar
#./sonar.sh start
Now the server is started and thanks for your support.

Fred

1 Like