Issue with Android plugin while upgrading to Sonarqube 7.8-community

Hello Members,

We have a Sonarqube instance (6.7.6-community) running on Kubernetes. When I try to upgrade it to Sonarqube 7.8-community I get an error related to the Android plugin as below.

Is the Android plugin no more supported in 7.x versions?

INFO web[o.s.s.p.ServerPluginRepository] Deploy plugin YAML Analyzer / 1.4.2
WARN web[o.s.c.p.PluginLoader] API compatibility mode is no longer supported. In case of error, plugin Android [android] should package its dependencies.
INFO web[o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.WebServiceFilter@74114df3 [pattern=UrlPattern{inclusions=[/api/system/migrate_db., …], exclusions=[/api/properties, …]}]
INFO web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
ERROR web[o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalStateException: Fail to load plugin Android [android]

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    a. Sonarqube 6.7.6-community
  • what are you trying to achieve
    a. trying to upgrade to Sonarqube 7.8-community
  • what have you tried so far to achieve this
    a. I have tried to remove the Android plugin manually from 6.7.6 before upgrading to 7.8. With this, the upgrade happens and the DB too gets migrated in the /setup page, but the Sonarqube pod fails to run after the upgrade and gives below error.

2021.02.03 14:52:59 WARN web[o.s.c.p.PluginLoader] API compatibility mode is no longer supported. In case of error, plugin Android [android] should package its dependencies.
2021.02.03 14:53:00 INFO web[o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.WebServiceFilter@3cef1bed [pattern=UrlPattern{inclusions=[/api/system/migrate_db., …], exclusions=[/api/properties, …]}]
2021.02.03 14:53:00 INFO web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2021.02.03 14:53:01 ERROR web[o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalStateException: Fail to load plugin Android [android]
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:82)
at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:559)
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/batch/Sensor
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.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:37)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
at org.sonar.plugins.android.AndroidPlugin.getExtensions(AndroidPlugin.java:48)
at org.sonar.api.SonarPlugin.define(SonarPlugin.java:51)
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:72)
… 9 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.sonar.api.batch.Sensor
at org.sonar.classloader.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:41)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
… 25 common frames omitted
2021.02.03 14:53:01 INFO web[o.s.p.ProcessEntryPoint] Hard stopping process
2021.02.03 14:53:01 INFO app[o.s.a.SchedulerImpl] Process[web] is stopped
2021.02.03 14:53:01 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2021.02.03 14:53:01 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2021.02.03 14:53:01 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped

Hello @omkar.patil,

First of all why are you upgrading to SonarQube 7.8 ? This version is neither the LTS (7.9) not the latest (8.6). It’s not a good idea to chose something intermediate that’s not LTS or Latest.
You will get little support from us on that version. I recommend you to upgrade to 7.9 (first), and possible to upgrade again to the latest to benefit from the latest features

Now about your question:

  • The Android plugin is not maintained by SonarSource so we can’t help you on this. You should ask the same question or open an issue on the open source repository of the plugin maintainer
  • If you use the android plugin that was once referenced on our web site, well, it is very old and it’s quite likely that it is not compatible with recent versions of SonarQube. You may find updates directly on one of the forks of that plugin (several exist see google sonar android plugin
  • With recent versions of SonarQube it’s possible to import issues from any external linters without the need of any plugin, provided that you can present those issues in a generic (JSON) format.
    So if you feel capable of transforming the Android lint lint.xml file into the SonarQube Generic Issue Report format you would not need any SonarQube android lint plugin anymore.

Olivier

Hey Olivier, Thanks a lot for the quick response.

We are going for 7.8 only because from 7.9 the support to MySQL is not there. We do not want to migrate to any other DB currently as we have many dependencies hence want to stick with 7.8 as it still supports MySQL. So is there anything or any documentation that I can refer to that will help me with 7.8 version?

I will try to look for other plugins for android in the meanwhile.

Thanks you.

Hello,

From the main documentation home page https://docs.sonarqube.org/ you can select the SonarQube version you want the docs for, in you case Documentation | SonarQube Docs
Beyond, this everything I told you about for 7.9 is probably also true for 7.8 so the options would be the same (find an android plugin compatible with 7.8 in the community, or use the generic issues import)

Just to finish on this: In case you are not aware, when support for MySQL was dropped, we released a tool called MySQL migrator to help users migrate the SonarQube MySQL database to another database (postgres, SQL Server or Oracle…)
You can use that tool when ready to upgrade further than 7.8

Olivier

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