Sonar services not starting

Hi,

We have upgraded our sonarqube version from Version 9.7 (build 56709) to Version 9.9 LTS. Before upgrading it to the newer version we had stopped the sonar daemon service. But now after the upgrade sonar service is NOT starting. Our OS is CentOS Linux release 7.9.2009 (Core).

Logs from journal -u sonar:

Feb 09 09:51:20 sonarqube sonar.sh[4835]: Starting SonarQube...
Feb 09 09:51:20 sonarqube sonar.sh[4835]: Removed stale pid file: ./SonarQube.pid
Feb 09 09:51:20 sonarqube systemd[1]: Started SonarQube Server.
Feb 09 09:51:20 sonarqube systemd[1]: sonar.service: main process exited, code=exited, status=1/FAILURE
Feb 09 09:51:20 sonarqube systemd[1]: Unit sonar.service entered failed state.
Feb 09 09:51:20 sonarqube systemd[1]: sonar.service failed.
Feb 09 09:51:20 sonarqube systemd[1]: sonar.service holdoff time over, scheduling restart.
Feb 09 09:51:20 sonarqube systemd[1]: Stopped SonarQube Server.
Feb 09 09:51:20 sonarqube systemd[1]: start request repeated too quickly for sonar.service
Feb 09 09:51:20 sonarqube systemd[1]: Failed to start SonarQube Server.
Feb 09 09:51:20 sonarqube systemd[1]: Unit sonar.service entered failed state.
Feb 09 09:51:20 sonarqube systemd[1]: sonar.service failed.

systemctl status sonar:

   Loaded: loaded (/etc/systemd/system/sonar.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2023-02-09 10:17:08 EST; 19min ago
  Process: 2678 ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop (code=exited, status=0/SUCCESS)
  Process: 8231 ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start (code=exited, status=0/SUCCESS)
 Main PID: 8254 (code=exited, status=1/FAILURE)

Feb 09 10:17:08 sonarqube systemd[1]: sonar.service: main process exited, code=exited, status=1/FAILURE
Feb 09 10:17:08 sonarqube systemd[1]: Unit sonar.service entered failed state.
Feb 09 10:17:08 sonarqube systemd[1]: sonar.service failed.
Feb 09 10:17:08 sonarqube systemd[1]: sonar.service holdoff time over, scheduling restart.
Feb 09 10:17:08 sonarqube systemd[1]: Stopped SonarQube Server.
Feb 09 10:17:08 sonarqube systemd[1]: start request repeated too quickly for sonar.service
Feb 09 10:17:08 sonarqube systemd[1]: Failed to start SonarQube Server.
Feb 09 10:17:08 sonarqube systemd[1]: Unit sonar.service entered failed state.
Feb 09 10:17:08 sonarqube systemd[1]: sonar.service failed.

What could be the issue? Please help us out.

Thanks!

What do the logs say?

1 Like

Hi Colin,

We only have the nohup.log in the logs directory of sonarqube -
[root@sonarqube logs]#

total 8
drwxr-xr-x.  2 sonar sonar  41 Feb  9 09:42 .
drwxr-xr-x. 11 sonar sonar 172 Feb  3 11:27 ..
-rw-r--r--.  1 sonar sonar 317 Feb  9 11:49 nohup.log
-rw-r--r--.  1 sonar sonar  88 Feb  3 11:19 README.txt

And it shows the below log -
[root@sonarqube logs]#

Error: LinkageError occurred while loading main class org.sonar.application.App
        java.lang.UnsupportedClassVersionError: org/sonar/application/App has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Class file version 61 = Java 17, version 55 = Java 11
The new SonarQube LTS requires Java 17, obviously you didn’t upgrade it on your server.

4 Likes

@milbrandt is right, and it’s mentioned in the upgrade notes!

SonarQube server requires Java 17
Java 17 is required for SonarQube server. Use of Java 11 is no longer supported. See the documentation on prerequisites for more information. (SONAR-17566)

1 Like

Hey @Colin

What risks are there associated with upgrading from Java 11 to 17? I have a VM running my SonarQube 9.8 instance and would like to upgrade to the 9.9 LTS version.

My only concern with the upgrade is what impact to my current running instance would that have? I ask because I have a rigid rollout strategy for SonarQube due to hard learned lessons in the past. My rollout strategy involves spinning up a temporary instance (I call it “staging”) of the latest version of SonarQube with all the plugins my company uses alongside the primary instance (I call it “production”). I then run that staging instance for a while with a couple repo pipelines configured to point to that staging instance while I ensure everything is stable and works as expected. Once I’ve done that (usually takes a day or two), I rollout a change to the primary instance to which everybody else’s pipelines are pointing.

Would there be any negative impacts to my production instance if I install Java 17 on my VM?

TIA! :slight_smile:

SonarQube v9.8 also supports Java 17, it’s just that it becomes required in SonarQube v9.9!

So I would specifically recommend uninstalling Java 11, but installing Java 17 shouldn’t have a negative impact.

2 Likes