Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecat

Starting SonarQube…
2022.11.30 19:21:10 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory C:\Sonarqube\sonarqube-9.7.1.62043\temp
2022.11.30 19:21:10 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:53330]
2022.11.30 19:21:10 INFO app[o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [C:\Sonarqube\sonarqube-9.7.1.62043\elasticsearch]: C:\Program Files\Java\jdk-19\bin\java -XX:+UseG1GC -Djava.io.tmpdir=C:\Sonarqube\sonarqube-9.7.1.62043\temp -XX:ErrorFile=…/logs/es_hs_err_pid%p.log -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djna.tmpdir=C:\Sonarqube\sonarqube-9.7.1.62043\temp -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dio.netty.allocator.numDirectArenas=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j2.formatMsgNoLookups=true -Djava.locale.providers=COMPAT -Dcom.redhat.fips=false -Xmx512m -Xms512m -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=C:\Sonarqube\sonarqube-9.7.1.62043\elasticsearch -Des.path.conf=C:\Sonarqube\sonarqube-9.7.1.62043\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
2022.11.30 19:21:10 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
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(System.java:423)
at org.elasticsearch.bootstrap.Security.setSecurityManager(Security.java:99)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:70)
2022.11.30 19:21:11 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2022.11.30 19:21:11 INFO app[o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2022.11.30 19:21:11 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped

My jdk version is 19 and the sonaqube version is 9.7
For my friend its working fine I tried but its getting same

Hey there.

As noted in the requirements documentation, you should use Java 11 to start the server.

Hi I have sonarqube 10.3, JDK ver 21, but…

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(System.java:429)
	at org.sonar.process.PluginSecurityManager.restrictPlugins(PluginSecurityManager.java:42)
	at org.sonar.server.app.WebSecurityManager.apply(WebSecurityManager.java:47)
	at org.sonar.server.app.WebServer.main(WebServer.java:101)

Hi I am also facing the same issue. as @ delphi.ventas
I am having JDK 21.

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(System.java:429)
	at org.sonar.process.PluginSecurityManager.restrictPlugins(PluginSecurityManager.java:42)
	at org.sonar.server.app.WebSecurityManager.apply(WebSecurityManager.java:47)
	at org.sonar.server.app.WebServer.main(WebServer.java:101)
2023.12.15 17:33:33 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [Web Server]: 1
2023.12.15 17:33:33 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2023.12.15 17:33:33 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2023.12.15 17:33:33 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.12.15 17:33:33 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

It Worked if i downgrade my jdk version to 17.

Is it a bug that sonarqube doesn’t support jdk21 version?

The requirements indicate that you should use Java 17.

I could resolve this with the following instructions:
1- Uninstall the current installed Java version.
2- I was using Windows 10, so I downloaded and installed this JAVA version https://download.oracle.com/java/17/archive/jdk-17_windows-x64_bin.msi
3- Modified this file \sonarqube-10.6.0.92116\bin\windows-x86-64\StartSonar.bat with the following command:

echo Starting SonarQube…
“F:\Program Files\Java\jdk-17\bin\java” -Xms8m -Xmx32m^
-Djava.awt.headless=true^
–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^
-cp “%REALPATH%…..\lib\sonar-application-10.6.0.92116.jar” “org.sonar.application.App”
4- Then, as administrator, I opened the cmd, and type startsonar.bat
5- then HTTP://localhost:9000 showed me SonarQube working as expected.

1 Like

I am using sonarqube 10.7 and Java 21 still getting this, Could you help me with this as per this post SonarCloud supports Java 21 code scanning! - #13 by Colin Sonar 10.5 onwards supports Java 21

Simply installing the jdk v17 followed by uninstalling any more reccent version did the trick for me.

It’s been a year since the 15th of December 2023, there’s still no resolution for the Security Manager.
This topic is still running since its opening 2 years ago, besides 18.0k views…
(The requirements are now a 404 link.)

Hey @Decembre

You can find an updated link to the requirements here.

We will probably support Java 21 as a server runtime before the new LTA version of SonarQube, however… this is not a bug to us. We plainly state the required version of Java to start SonarQube, and will have to make some adapations to support newer versions.