Java Runtime Errors Caused by Version Upgrade

Hello, SonarTeam

We are currently using SonarQube 8.9LTS.

We are planning to upgrade to 9.9LTS and are in the process of verifying the upgrade.

After the upgrade, I am getting the following error message and am unable to start SonarQube.

Please let me know if there is any solution to this problem.

The error message is as follows

[sonar@sonarqube-developer ~]$ /opt/sonarqube/bin/linux-x86-64/sonar.sh start
/usr/bin/java
Starting SonarQube…
Started SonarQube.
[sonar@sonarqube-developer ~]$ /opt/sonarqube/bin/linux-x86-64/sonar.sh status
/usr/bin/java
Removed stale pid file: ./SonarQube.pid
SonarQube is not running.
[sonar@sonarqube-developer ~]$ cd /opt/sonarqube/logs
[sonar@sonarqube-developer logs]$ cat nohup.log
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

Regards.
Kisho Fukue

Hey there.

As noted 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).

Hi, Colin,

I am very grateful for it.

I will try again after implementing the Java update.

Sincerely,
Kisho Fukue

Hi Team,

Thank you for your response the other day.

I installed Java 17 using the alternative install command.

[starsshd@sonarqube-developer bin]$ java -version
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)

I then ran SonarQube and checked the status with the status command, but it did not seem to start properly.

[sonar@sonarqube-developer ~]$ /opt/sonarqube/bin/linux-x86-64/sonar.sh start
/usr/bin/java
Starting SonarQube...
Started SonarQube.
[sonar@sonarqube-developer ~]$ /opt/sonarqube/bin/linux-x86-64/sonar.sh status
/usr/bin/java
Removed stale pid file: ./SonarQube.pid
SonarQube is not running.

I checked the log file and found the following status.

[sonar@sonarqube-developer ~]$ cd /opt/sonarqube/logs
[sonar@sonarqube-developer logs]$ cat nohup.log
2023.05.29 11:16:46 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube-9.9.0.65466/temp
2023.05.29 11:16:46 ERROR app[][o.s.application.App] Startup failure
java.lang.IllegalArgumentException: Unable to create shared memory :
        at org.sonar.process.sharedmemoryfile.AllProcessesCommands.<init>(AllProcessesCommands.java:103)
        at org.sonar.application.AppFileSystem.reset(AppFileSystem.java:63)
        at org.sonar.application.App.start(App.java:53)
        at org.sonar.application.App.main(App.java:81)
Caused by: java.io.FileNotFoundException: /opt/sonarqube-9.9.0.65466/temp/sharedmemory (Permission denied)
        at java.base/java.io.RandomAccessFile.open0(Native Method)
        at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:344)
        at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:259)
        at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:213)
        at org.sonar.process.sharedmemoryfile.AllProcessesCommands.<init>(AllProcessesCommands.java:100)
        ... 3 common frames omitted

Is there anything else that may be preventing SonarQube from running?

Sincerely,
Kisho Fukue

Thanks.

The first thing I would do is check permissions on the file system for the user running your SonarQube instance. Are they the owner (chown) of all the files in the SonarQube installation directory?

Hi, Colin

I have checked on my end and found that there are several directories under which the permissions are not appropriate.

After modifying the permissions, SonarQube was successfully activated!

[sonar@sonarqube-developer temp]$ /opt/sonarqube/bin/linux-x86-64/sonar.sh start
/usr/bin/java
Starting SonarQube...
Started SonarQube.
[sonar@sonarqube-developer temp]$ /opt/sonarqube/bin/linux-x86-64/sonar.sh status
/usr/bin/java
SonarQube is running (10183).

Thank you so much.

Sincerely,
Kisho Fukue

1 Like

Great! Thank you for the follow-up.

Hi, Team

Thank you for following up on the upgrade process last time.

In our operation, before the upgrade, static code analysis was performed by a plugin called ESLint.
(GitHub - sleroy/SonarEsLintPlugin: SonarQube plugin for EsLint linter)

Since ESLint is already out of the supported version, we believe that static code analysis by other means is necessary.

I am wondering if a service called sonarlint would be able to do the same kind of static code analysis, is it possible?
(Linter IDE Tool & Real-Time Software for Code | Sonar | Sonar)

If not, we would like to know if you know of any plug-ins that can be used for static code analysis.

Sincerely,
Kisho Fukue