Important Points to Keep in Mind When Upgrading SonarQube

Our latest upgrade of SonarQube took far more time than expected. I did a few upgrades in the last two years, but none was such a challenge. Everything that can go wrong has gone wrong, and without my prior experience, I may have given up. Let me point out the obstacles you may encounter and give you a few tips to find the cause of these problems.

 

Upgrade all your plug-ins

Before you do anything, you should update all your plug-ins. If you no longer need them, you should use this opportunity to remove them. You may need to restart your SonarQube server a few times, but what you do now you do not need to do later.

 

Create a backup

A backup is always a good idea, especially when you need to upgrade the database of SonarQube. Backup your database right now and put it somewhere where you can find it. The same is true for the installation directory. When you have a backup, you will not modify the files in the wrong directory.

 

Can you upgrade on the newest version?

Check the update guide if you can upgrade from your current version to the newest release. Maybe you need to make the upgrade in steps and first install the newest LTS version. This is no big problem, but it will take additional time.

The command line tool to start SonarQube will point out if you overlooked the upgrade advice and run a too new version with a too old database:

2019.10.16 21:52:04 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed: Current version is too old. Please upgrade to Long Term Support version firstly.

 

Check the log files!

Only when you read the log files do you have a chance to figure out what is the problem with your current state of SonarQube. You find the log files inside your installation directory in the folder logs. There should be these five different log files:

  • access.log: for all the HTTP requests
  • ce.log: for the compute engine (used to analyse the code)
  • es.log: for the Elastic Search logs
  • sonar.log: for the main process (the SonarQube App)
  • web.log: for the web server

You can look at the last modified date of those files and start reading the last lines of the newest file. With that approach, you do not need to know how SonarQube works internally. Find the first exception or error and google that to find an explanation on what went wrong.

 

Open JDK 13 not supported

For SonarQube 8 you can only use a JDK 11. Older versions do not work and give you this error:

Launching a JVM…
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: SonarQube requires Java 11+ to run

java.lang.IllegalStateException: SonarQube requires Java 11+ to run
at org.sonar.application.App.checkJavaVersion(App.java:93)

Newer versions like the Open JDK 13 do not work either, but there the error messages are much harder to understand:

2019.10.16 21:33:24 ERROR es[][o.e.b.Bootstrap] Guice Exception: java.security.AccessControlException: access denied (“java.lang.RuntimePermission” “accessClassInPackage.jdk.internal.vm.annotation”)

 

Conclusion

Most upgrades for SonarQube work without any problems. When you run into a problem, you can be sure that there will more. Check the log files and read the upgrade guide again to figure out what is going on.
 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.