Sonar not starting with JDK 21 and getting error

When I try to start the sonarqube version with JDK 21 getting error as below, and when the same is tried with JDK 17 its working fine.

2024.05.08 15:19:58 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\Users\Documents\Softwares\sonarqube-\temp
2024.05.08 15:19:58 INFO  app[][] Elasticsearch listening on [HTTP:, TCP:]
2024.05.08 15:19:58 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [C:\Users\Documents\Softwares\sonarqube-\elasticsearch]: C:\Users\Documents\Softwares\jdk-21.0.3\bin\java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=C:\Users\Documents\Softwares\sonarqube-\elasticsearch -Des.path.conf=C:\Users\Documents\Softwares\sonarqube-\temp\conf\es -Des.distribution.type=tar -cp C:\Users\Documents\Softwares\sonarqube-\elasticsearch\lib\*;C:\Users\Documents\Softwares\sonarqube-\elasticsearch\lib\cli-launcher\* org.elasticsearch.launcher.CliToolLauncher
2024.05.08 15:19:58 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
May 08, 2024 3:20:06 PM sun.util.locale.provider.LocaleProviderAdapter <clinit>
WARNING: COMPAT locale provider will be removed in a future release
2024.05.08 15:20:24 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2024.05.08 15:20:24 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [C:\Users\Documents\Softwares\sonarqube-]: C:\Users\Documents\Softwares\jdk-21.0.3\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8\Users\Documents\Softwares\sonarqube-\temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/ --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/ -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-;C:\Users\Documents\Softwares\sonarqube-\lib\jdbc\h2\h2-2.2.224.jar C:\Users\Documents\Softwares\sonarqube-\temp\sq-process5960965584461263725properties
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(
	at org.sonar.process.PluginSecurityManager.restrictPlugins(
2024.05.08 15:20:25 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [Web Server]: 1
2024.05.08 15:20:25 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2024.05.08 15:20:25 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2024.05.08 15:20:25 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

Welcome :slight_smile:

documentation has only Java 17 in server installation requirerements

whereas for the Sonarqube analysis it has

A Java runtime environment:

  • Oracle JRE or OpenJDK.
  • Minimum version: Java 17.

Means it’s Java 17 for Sonarqube server and Java >= 17 for Sonarqube scanners.


But the documentation in this page shows it supports Java 21

OK, you got that wrong.


relates to the Sonar Java plugin being able to understand Java 21 syntax.
This has nothing to do with the Sonarqube server itself.

1 Like

ok thanks :slight_smile:

the initial answer did help – thanks for that

here is what i tried:

  • i tried a few versions of JDK 17 on my windows machine one by one.
    • openjdk 17 GA
    • openjdk 17.0.1
    • openjdk 17.0.2
    • openjdk 17.0.11
  • i tried setting system-environment-variable JAVA_HOME to the right version,
  • also set the JAVA_HOME/bin to the PATH variable
  • None of this was helping
  • i was still able to see this one in both sonar.log and es.log – it was picking up java 21 from Windows system (JRE)

so after doing some more research i added this variable in
conf/ file Files/Java/openlogic-openjdk-17.0.11+9-windows-x64/bin/java

i also added yet another windows system-environment-variables ES_JAVA_HOME and SONAR_JAVA_HOME and set them to jdk 17 – i saw the ES_JAVA_HOME variable in /elasticsearch/bin/elasticsearch-env file
after this change i was able to get sonarqube running

i can now access sonarqube on localhost:9099
the first run of sonarqube has created necessary tables under the sonarqube database in Postgres successfully

thank you all for responding to the post

1 Like