Unable to start SonarQube service after upgrade from version 8.9 to 9.9 LTS

Hi

After updating from 8.9 LTS to 9.9 LTS I cannot start SonarQube as a service but it works when launching StartSonar.bat

When launching %SONARQUBE_HOME%\bin\windows-x86-64\StartSonar.bat as administrator, SonarQube is working as expected as long as the command prompt is active.

Installing the service with %SONARQUBE_HOME%\bin\windows-x86-64\SonarService.bat install works without a problem and the service is listed as service. Starting the service in the service prompt return immediately an windows error. No SonarQube logs are updated in any case.

When starting the service with %SONARQUBE_HOME%\bin\windows-x86-64\SonarService.bat start, as administrator, the console just prints

2023-04-12 15:29:00,084 INFO  - Starting service 'SonarQube (SonarQube)'...
2023-04-12 15:29:00,209 INFO  - Service 'SonarQube (SonarQube)' started successfully.

and the SonarServiceWrapper.wrapper.log shows:

2023-04-12 15:30:03,007 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.9.0.65466.jar" "org.sonar.application.App" 
2023-04-12 15:30:03,023 INFO  - Started process 6920
2023-04-12 15:30:03,023 DEBUG - Forwarding logs of the process System.Diagnostics.Process (java) to WinSW.IgnoreLogAppender

No other SonarQube logs gets edited.

When testing the service with %SONARQUBE_HOME%\bin\windows-x86-64\SonarService.bat test as administrator I get the following result:

2023-04-12 15:31:37,450 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.9.0.65466.jar" "org.sonar.application.App"
2023-04-12 15:31:37,497 INFO  - Started process 1292
2023-04-12 15:31:38,528 INFO  - Stopping SonarQube
2023-04-12 15:31:38,607 WARN  - Failed to attach to console. Access is denied
2023-04-12 15:31:38,653 INFO  - Finished SonarQube

I was not able figuring out what “Failed to attach to console. Access is denied” shall explain to me for error handling. I’m using Java 17 on a windows 2019 server. Any idea what could wen’t wrong?

Hi,

Welcome to the community!

It’s not clear to me how you’re starting the service, so I want to make sure you saw this upgrade note:

To install, uninstall, start or stop SonarQube as a service on Windows, now you should use %SONAR_HOME%\bin\windows-x86-64\SonarService.bat install .

Does that help?

 
Ann

Hi Ann

I wen’t trough the steps from the upgrade note. The only important part for me was upgrading Java from 11 to 17. All other topics do not concern me.

I’m able to install the service as you describe. But I cannot start the service afterwards. Neither in the services panel nor via %SONAR_HOME%\bin\windows-x86-64\SonarService.bat start

I cannot see an error message, it just prints a successful start to the SonarServiceWrapper.wrapper.log and that’s it.

Testing the service using %SONAR_HOME%\bin\windows-x86-64\SonarService.bat test shows me an error ‘Failed to attach to console. Access is denied’

mike

Hi,

Can you share precisely what version of Java you’re using?

 
Thx,
Ann

I’m using the following version of Java (Corretto):

java --version
openjdk 17.0.6 2023-01-17 LTS
OpenJDK Runtime Environment Corretto-17.0.6.10.1 (build 17.0.6+10-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.6.10.1 (build 17.0.6+10-LTS, mixed mode, sharing)

Regards
Mike

Hi Mike,

Thanks for the version. I think it’s possible your problem is related to this one (altho that user’s on a different JDK version).

I’m going to flag this for more expert eyes.

 
Ann

Hi @SeleMike

Could you check in the Event Viewer whether there are any logs in Event Viewer → Windows Logs when you try to start SonarQube as a service? There should be some hints.

Hi @Lukasz_Jarocki

I got three entry on every try to start the service while only the the last entry is a warning:

For any reason, today I was not even able to start SonarQube as standalone application, some error coming from Elasticsearch so I restarted the whole server. After restarting the Server, SonarQube is starting now as service as expected. I do not know what went wrong in the past, but for any reason it seems to be fixed.

I’m hesitant to say that a reboot fixed the problem because I don’t know the reason or root cause.

1 Like

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