SonarQube - QProfile 丢失

SonarQube - QProfile is missing

我已将 SonarQube 从 4.4 升级到 5.1,但出现以下错误。

2015.04.09 11:56:50 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalStateException: Could not execute normalization for stack
    at org.sonar.server.search.IndexQueue.processActionsIntoQueries(IndexQueue.java:136) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.search.IndexQueue.enqueue(IndexQueue.java:82) ~[sonar-server-5.1.jar:na]
    at org.sonar.core.persistence.DbSession.commit(DbSession.java:62) ~[sonar-core-5.1.jar:na]
    at org.sonar.server.db.BaseDao.synchronizeAfter(BaseDao.java:370) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.db.BaseDao.synchronizeAfter(BaseDao.java:356) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.search.IndexSynchronizer.synchronize(IndexSynchronizer.java:104) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.search.IndexSynchronizer.executeDeprecated(IndexSynchronizer.java:74) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.platform.ServerComponents.doPrivileged(ServerComponents.java:850) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:43) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.platform.ServerComponents.executeStartupTasks(ServerComponents.java:847) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:126) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:122) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.platform.Platform.doStart(Platform.java:81) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.platform.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:44) ~[sonar-server-5.1.jar:na]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4720) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_20]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_20]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_20]
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException: QProfile is missing
    at java.util.concurrent.FutureTask.report(Unknown Source) [na:1.8.0_20]
    at java.util.concurrent.FutureTask.get(Unknown Source) [na:1.8.0_20]
    at org.sonar.server.search.IndexQueue.processActionsIntoQueries(IndexQueue.java:118) ~[sonar-server-5.1.jar:na]
    ... 22 common frames omitted
Caused by: java.lang.NullPointerException: QProfile is missing
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204) ~[guava-10.0.1.jar:na]
    at org.sonar.core.qualityprofile.db.ActiveRuleKey.of(ActiveRuleKey.java:45) ~[sonar-core-5.1.jar:na]
    at org.sonar.core.qualityprofile.db.ActiveRuleDto.getKey(ActiveRuleDto.java:65) ~[sonar-core-5.1.jar:na]
    at org.sonar.server.qualityprofile.index.ActiveRuleNormalizer.normalize(ActiveRuleNormalizer.java:79) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.qualityprofile.index.ActiveRuleNormalizer.normalize(ActiveRuleNormalizer.java:45) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.search.action.InsertDto.doCall(InsertDto.java:47) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.search.action.IndexAction.call(IndexAction.java:61) ~[sonar-server-5.1.jar:na]
    at org.sonar.server.search.action.IndexAction.call(IndexAction.java:28) ~[sonar-server-5.1.jar:na]
    ... 4 common frames omitted

所有插件都已升级到最新版本,旧的不受支持的插件已被删除。

包装器停止,SonarQube 不停止 运行

我遇到了同样的问题并解决了。

"QProfile is missing" 表示一些活动规则引用了缺少的质量配置文件。

所以我查看了我的 sonarqube 数据库并执行了下面的 SQL。

SELECT DISTINCT a.profile_id
FROM sonar.active_rules a
LEFT JOIN sonar.rules_profiles b ON a.profile_id = b.id
WHERE b.id IS NULL
;

我找到了一些 profile_id 然后删除了这些记录。然后,我启动了sonarQube。现在 sonarQube 看起来工作正常。

如果能帮到你我会很高兴