SonarQube OnPrem issue on upgrade from 8.9 to 9.9

Hello,
I’m trying to upgrade from 8.9 to 9.9, it’s a sonarqube enterprise version, I’m running it on windows server 2019, with openjdk 17 and sql server 2019.
I followed the upgrade documentation to the letter, everything was fine, but when I tried to start the windows service to launch the upgrade, I’m facing an issue, I’m experiencing the following error :

2024-04-19 11:07:10,487 DEBUG - Starting WinSW in service mode
2024-04-19 11:07:10,549 INFO  - Starting C:\Program Files\Microsoft\jdk-17.0.10.7-hotspot\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.9.4.87374.jar" "org.sonar.application.App" 
2024-04-19 11:07:10,565 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)

I have the same error in the event viewer.

I already have tried to:

  • define a “log on” admnistrator account on the service : same result
  • define “run this program as admnistrator” on SonarServiceWrapper.exe: same result
  • given full access to everyone on the sonarqube folder recursively: same result
  • deactivate the antivirus on the server: same result
  • I have tried to run the command C:\Program Files\Microsoft\jdk-17.0.10.7-hotspot\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.9.4.87374.jar manually: it worked but that doesn’t solve my problem.

From what I see it seems that the SonarServiceWrapper.exe is unable to start a process with the java command, but I cannot figure why.

Can you help me figuring out where I should give more rights so that the windows service can start and continue the upgrade ?

Best regards,

Paul Ferrand

Hey there.

This may sound stupid simple, but can you try uninstalling the service and resinstalling it?

Hi Colin,
I have tried to unistall then reinstall it, but it’s not working. I even uninstalled it, reboot the server and the installed it just to be sure.
In my point of vue the issue is that the wrapper cannot start a process when trying to launch the java command, but I cannot figure out why.

Paul

This is a long shot, but can you try adjusting the SONAR_JAVA_HOME environment variable and make sure it points to your Java 17 installation?

Hi Colin,
I have added the environment variable SONAR_JAVA_HOME, I also rebooted the server afterwards to be sure, but the error stays the same, I checked the rights on both folders the current (8.9.10) and the new, it’s identical, I can’t figure out where is the issue here.
Thanks for all the support.
Regards,

Paul

Thanks. I’m combing through a few support tickets with a similar error message. A few points:

  • I’d like to know – does running StartSonar.bat bring up SonarQube successfully?
  • As a troubleshooting step, you could try renaming the service in lib/SonarServiceWrapperTemplate.xml and then proceeding with the service install.
  <id>SonarQubeTest</id>
  <name>SonarQubeTest</name>
  <description>SonarQube Test</description>
  • One issue was solved because powershell.exe wasn’t in the PATH. Because powershell is referenced in SonarService.bat, this was a problem. You might want to check that powershell can be run in your terminal.

Hello Colin,
First of all, thanks for your great help, I finally found out where was the issue.
The issue was coming from the environment variable SONAR_JAVA_PATH, I set the value as “C:\Program Files (x86)\Java\jdk-17.0.2\bin”, but the right value to set was “C:\Program Files (x86)\Java\jdk-17.0.2\bin\java.exe”, then I deleted the service and executed SonarService.bat --install in a new command window.
Now the SonarQube service is running successfully.
Thanks again for your time, I hope it will help other people.

Best regards

Paul

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.