SonarQube is a very powerful tool, which can be used to inspect your code quality. It is able to detect bugs, code smells, and security vulnerabilities and provides continuous inspections. Many Developers and the whole Teams use this fantastic tool on a daily basis. SonarSource is improving SonarQube, so it’s a normal behavior, that sometimes we need to upgrade our application to a newer version. If you just did that and now you see “Fail to load plugin Findbugs” in your logs, AND you tried to upgrade to the 7.4 version, I think I have a solution of your problem.
Before each upgrade, we should see the changelog and upgrade notes. We should, but we don’t always do that. Hence, sometimes we can see something surprising in our logs. When we want to upgrade SonarQube, we need to check not only the Changelog but also (among others) Plugin Version Matrix. It tells us which plugin version is compatible with the SonarQube version we want to update to. Yes, if you think that this is the problem, in this case, you’re right.
I see Fail to load plugin Findbugs – what should I do?
Ok, so you’ve just upgraded your SonarQube and database (https://SONAR_URL/setup), but your Sonar doesn’t want to become fully operational. Let’s check logs! They (almost) always tell the truth. Ok, so what do we have there…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
2018.12.01 14:31:45 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube java.lang.IllegalStateException: Fail to load plugin Findbugs [findbugs] at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:82) at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:586) at org.sonar.server.platform.Platform.start(Platform.java:211) at org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:185) at org.sonar.server.platform.Platform.access$500(Platform.java:46) at org.sonar.server.platform.Platform$1.lambda$doRun$0(Platform.java:119) at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371) at org.sonar.server.platform.Platform$1.doRun(Platform.java:119) at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NoClassDefFoundError: org/sonar/api/BatchExtension at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125) at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37) at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87) at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76) at org.sonar.plugins.findbugs.FindbugsPlugin.define(FindbugsPlugin.java:55) at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:72) ... 9 common frames omitted Caused by: java.lang.ClassNotFoundException: org.sonar.api.BatchExtension at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39) at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87) at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76) ... 24 common frames omitted 2018.12.01 14:31:45 INFO web[][o.s.p.StopWatcher] Stopping process |
Hmm, it doesn’t look good, right? But don’t worry! Logs clearly say that the problem is with one of the plugins… So now let’s check Plugin Version Matrix.
Do you see that? Yes, this plugin is incompatible with our SonarQube. Hope you have backup… 🙂 However, if you don’t, you can still use SonarQube 7.4.
I want to use SonarQube 7.4, what should I do?
If you don’t want to downgrade (or you are not able to do that – you don’t have backup or it’s the only one, production instance), you can still finish upgrade process. Fail to load plugin Findbugs means not more than… SonarQube cannot load this plugin. Removing this plugin will be enough to complete the upgrade.
I use a docker version with linked PostgreSQL docker, so it is very simple for me to remove that. My version doesn’t use docker volumes, both SonarQube and PostgreSQL use bind mounts. So in my case, I needed to do something like that:
1 |
rm /path/to/sonarqube/plugins/sonar-findbugs-plugin-3.7.0.jar |
and that was all. After that upgrade process has been finished properly, what you can see in the logs:
1 2 3 4 5 |
2018.12.01 14:34:39 INFO web[][o.s.s.p.Platform] WebServer is operational 2018.12.01 14:34:39 INFO app[][o.s.a.SchedulerImpl] Process[web] is up 2018.12.01 14:34:42 INFO ce[][o.s.ce.app.CeServer] Compute Engine is operational 2018.12.01 14:34:43 INFO app[][o.s.a.SchedulerImpl] Process[ce] is up 2018.12.01 14:34:43 INFO app[][o.s.a.SchedulerImpl] SonarQube is up |
Good to check before upgrade: