And you’ve verified that the user running the service (I guess that’s you?) has full read/write/execute permissions to the sonarqube-9.6.1 directory, recursive?
That error is coming from Windows, not SonarQube. Searching it took me to StackOverflow, where I find this:
This is generally the result of one of two things - either (a) your OnStart() method is throwing an exception or (b) the OnStart() method is not kicking off a thread to do work.
Since SonarQube absolutely starts a thread (three, actually) to do work, something else is happening. Another answer suggests:
I got this error and it was because the hard drive had filled up. It could be anything that keeps the service from running.
So you’re going to need to look at your environment to figure out what’s preventing SonarQube from starting. Typically I would expect the answer to be in the server logs. Since you don’t have server logs, either the problem is that SonarQube can’t write its logs, or that the problem is happening very, very early. Note that “helpful” Windows processes (e.g. Windows Defender) can interfere.
2022.09.26 06:04:20 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [D:\sonarqube-9.6.1\elasticsearch]: C:\Program Files\Java\jdk-18.0.2.1\bin\java -XX:+UseG1GC -Djava.io.tmpdir=D:\sonarqube-9.6.1\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=D:\sonarqube-9.6.1\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=D:\sonarqube-9.6.1\elasticsearch -Des.path.conf=D:\sonarqube-9.6.1\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
2022.09.26 06:04:20 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2022.09.26 06:04:21 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2022.09.26 06:04:21 INFO app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2022.09.26 06:04:21 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
2022.09.26 06:04:21 ERROR app[][o.s.a.p.EsManagedProcess] Failed to check status
org.elasticsearch.ElasticsearchException: java.lang.InterruptedException
at org.elasticsearch.client.RestHighLevelClient.performClientRequest(RestHighLevelClient.java:2695)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:2171)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:2137)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:2105)
at org.elasticsearch.client.ClusterClient.health(ClusterClient.java:151)
at org.sonar.application.es.EsConnectorImpl.getClusterHealthStatus(EsConnectorImpl.java:64)
at org.sonar.application.process.EsManagedProcess.checkStatus(EsManagedProcess.java:92)
at org.sonar.application.process.EsManagedProcess.checkOperational(EsManagedProcess.java:77)
at org.sonar.application.process.EsManagedProcess.isOperational(EsManagedProcess.java:62)
at org.sonar.application.process.ManagedProcessHandler.refreshState(ManagedProcessHandler.java:223)
at org.sonar.application.process.ManagedProcessHandler$EventWatcher.run(ManagedProcessHandler.java:288)
Caused by: java.lang.InterruptedException: null
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1048)
at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:243)
at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:75)
at org.elasticsearch.client.RestHighLevelClient.performClientRequest(RestHighLevelClient.java:2692)
... 10 common frames omitted
Reverted from Java 18 to Java 11. Basically updated the JAVA_HOME to point to Java 11.
But seems like Sonar is not able to pick up the correct java. I can see only java.exe in the SonarServiceWrapper.xml instead of the full path which was coming earlier. Not sure where else I need to update.