Getting error installing sonarqube-developer-9.6.1 in in server

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    sonarqube-developer-9.6.1
  • what are you trying to achieve
    install in sonarqube in windows server

I am trying to install and start sonarqube in a windows vm using openJDK 11

steps i followed

  1. installed openJDK and set the path in environment variables and also set SONAR_JAVA_PATH
  2. next i went to sonar service location “sonarqube-9.6.1\bin\windows-x86-64”
  3. run Sonarservice.bat install (which executed successfully)
  4. run sonarservice.bat start (failing with an error)

Error:

2022-09-01 00:03:47,069 DEBUG - Starting WinSW in service mode
2022-09-01 00:03:47,100 INFO  - Service 'SonarQube (SonarQube)' started successfully.
2022-09-01 00:03:47,116 INFO  - Starting JAVA_EXE  -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 "../../lib/sonar-application-9.6.1.59531.jar" "org.sonar.application.App" 
2022-09-01 00:03:47,131 ERROR - Failed to start service.
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at WinSW.Util.ProcessHelper.StartProcessAndCallbackForExit(Process processToStart, String executable, String arguments, Dictionary`2 envVars, String workingDirectory, Nullable`1 priority, ProcessCompletionCallback callback, LogHandler logHandler, Boolean hideWindow)
   at WinSW.WrapperService.StartProcess(Process processToStart, String arguments, String executable, LogHandler logHandler)
   at WinSW.WrapperService.DoStart()
   at WinSW.WrapperService.OnStart(String[] args)

Hi,

I notice that a Win32Exception is thrown:

Are you on a 64-bit system?

 
Ann

Hi Ann,
I am also getting similar error and I am on 64-bit system.

2022-09-19 11:08:03,720 ERROR - Failed to start service.
System.ComponentModel.Win32Exception (0x80004005): Access is denied
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at WinSW.Util.ProcessHelper.StartProcessAndCallbackForExit(Process processToStart, String executable, String arguments, Dictionary`2 envVars, String workingDirectory, Nullable`1 priority, ProcessCompletionCallback callback, LogHandler logHandler, Boolean hideWindow)
   at WinSW.WrapperService.StartProcess(Process processToStart, String arguments, String executable, LogHandler logHandler)
   at WinSW.WrapperService.DoStart()
   at WinSW.WrapperService.OnStart(String[] args)
1 Like

Hi @pwakhale,

Welcome to the community!

Can you confirm that the user SonarQube is (supposed to be) running as has full permissions, recursive, to the SonarQube directory?

 
Ann

Hi Ann,

I do have full access. The error message I get when I start it from the services (Windows service):

Hi,

Why don’t you check your server logs.

 
Ann

Server logs I have already shared in initial comment.

2022-09-21 07:08:46,323 DEBUG - Starting WinSW in service mode
2022-09-21 07:08:46,349 INFO  - Starting C:\Program Files\Java\jdk-11.0.6\bin  -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 "..\..\..\lib\sonar-application-9.6.1.59531.jar" "org.sonar.application.App" 
2022-09-21 07:08:46,360 ERROR - Failed to start service.
System.ComponentModel.Win32Exception (0x80004005): Access is denied
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at WinSW.Util.ProcessHelper.StartProcessAndCallbackForExit(Process processToStart, String executable, String arguments, Dictionary`2 envVars, String workingDirectory, Nullable`1 priority, ProcessCompletionCallback callback, LogHandler logHandler, Boolean hideWindow)
   at WinSW.WrapperService.StartProcess(Process processToStart, String arguments, String executable, LogHandler logHandler)
   at WinSW.WrapperService.DoStart()
   at WinSW.WrapperService.OnStart(String[] args)

Hi,

Did you follow the link I posted?

 
Ann

I don’t see all those folders in logs with latest version SonarQube 9.6.1. I can see only SonarServiceWrapper.wrapper.log
image

Hi,

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.

 
HTH,
Ann

Hi Ann,
I have reverted the JAVA_HOME to older version JDK 11 and now the issue is gone. I can see all the log files.

But now getting different error,

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

Hi,

Would you mind sharing what JDK 11 version you reverted from?

Regarding your new error, you should check your server logs. If the answer’s not obvious from there, please open a new thread.

 
Ann

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.

Is Sonar not supporting Java18?

You can close this thread as my issue is resolved by adding environment variable

Just confirm if Sonar is not supporting Java 18.