Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sonar-maven-plugin:3.1.1:sonar analyze error after upgrade to SonarQube 6.0

We just upgraded to SQ 6.0 and now some projects get the following error when analyzing with maven:

[INFO] --- sonar-maven-plugin:3.1.1:sonar (default-cli) @ gitlab-hook-dispatcher ---
[INFO] User cache: C:\Users\frank.jakop\.sonar\cache
[INFO] Load global repositories
[INFO] Load global repositories (done) | time=94ms
[INFO] User cache: C:\Users\frank.jakop\.sonar\cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=5ms
[INFO] SonarQube version: 6.0
[INFO] Default locale: "de_DE", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=162ms
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=1ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=73ms
[INFO] Load active rules
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.419 s
[INFO] Finished at: 2016-09-14T08:29:20+02:00
[INFO] Final Memory: 67M/495M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.1.1:sonar (default-cli) on project gitlab-hook-dispatcher: Unable to load component class org.sonar.scanner.report.ActiveRulesPublisher: Unable to load component interface org.sonar.api.batch.rule.ActiveRules: NullPointerException -> [Help 1]

Last part of trace is

Caused by: java.lang.NullPointerException
    at org.sonar.scanner.rule.DefaultActiveRulesLoader.readPage(DefaultActiveRulesLoader.java:99)
    at org.sonar.scanner.rule.DefaultActiveRulesLoader.load(DefaultActiveRulesLoader.java:59)
    at org.sonar.scanner.rule.ActiveRulesProvider.load(ActiveRulesProvider.java:102)
    at org.sonar.scanner.rule.ActiveRulesProvider.load(ActiveRulesProvider.java:63)
    at org.sonar.scanner.rule.ActiveRulesProvider.provide(ActiveRulesProvider.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
    at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
    at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
    at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
    at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
    at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
    at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
    at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:67)
    ... 72 more

This happens also when we use org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar and seems to be project specific, some projects work and some don't.

Can anyone provide a hint what's wrong here?

like image 322
Frank Avatar asked Sep 14 '16 06:09

Frank


1 Answers

Credit to @teryk-sonarsource-team, just making it an answer:

  1. Delete the directory data/es in your SonarQube installation.
  2. Restart SonarQube.

It will recompute all the ES indexes.

This resolved the problem for me in SonarQube 5.6.3.

like image 141
davidfmatheson Avatar answered Nov 01 '22 08:11

davidfmatheson