SonarQube jenkins作业失败并显示“无法执行请求”

时间:2015-10-28 10:02:38

标签: jenkins sonarqube sonarqube-4.5

我们正在运行SonarQube 4.5.1并使用Jenkins和SonarQube插件运行项目分析。 从三天前开始,我们在一些工作中遇到以下错误消息。

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project MYPROJECT: Fail to execute request [code=500, url=https://SONARQUBE/batch/project?key=com.myplugins.sonar.plugins:MYPROJECT&preview=false]: Fail to download [https://SONARQUBE/batch/project?key=com.myplugins.sonar.plugins:MYPROJECT&preview=false]. Response code: 500 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project MYPROJECT: Fail to execute request [code=500, url=https://SONARQUBE/batch/project?key=com.myplugins.sonar.plugins:MYPROJECT&preview=false]

Caused by: org.apache.maven.plugin.MojoExecutionException: Fail to execute request [code=500, url=https://SONARQUBE/batch/project?key=com.myplugins.sonar.plugins:MYPROJECT&preview=false]

Caused by: java.lang.IllegalStateException: Fail to execute request [code=500, url=https://SONARQUBE/batch/project?key=com.myplugins.sonar.plugins:MYPROJECT&preview=false]

Caused by: org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [https://SONARQUBE/batch/project?key=com.myplugins.sonar.plugins:MYPROJECT&preview=false]. Response code: 500

如果我将URL复制到浏览器,我会收到消息:

  

“您只能在不将结果推送到SonarQube服务器的情况下执行本地(干运行)SonarQube分析。请联系您的SonarQube管理员。”

设置& preview = true(出于好奇心)显示此消息:

  

“预期的一个结果(或null)由selectOne()返回,但找到:2”

代码或设置没有变化。

项目在项目概述中列出两次,但链接到同一项目仪表板(相同的密钥,相同的措施等)

“批量删除”显示没有重复项,也未列在“Ghost”标签下。

我们还查看了数据库并执行了以下声明:

SELECT * FROM projects where kee=MYPROJECT-KEY

仍未发现重复。

我们从未遇到类似的问题而且完全无能为力。有什么建议?

2 个答案:

答案 0 :(得分:0)

看起来上次成功的分析在数据库中留下了两个快照......原因未知。

mysql> SELECT rootProject.* , s.islast, s.id    FROM projects p     INNER JOIN snapshots s ON s.project_id=p.id AND s.islast=true INNER JOIN projects rootProject ON rootProject.id=s.root_project_id AND p.kee='PROJECTKEY';
+-------+---------------------------------------------------+---------+-------+-----------+------------+---------+----------+------------------+-----------+-----------+---------------------+------+------------------------------------+--------+----------+
| id    | name | description                                | enabled | scope | qualifier | kee        | root_id | language | copy_resource_id | long_name | person_id | created_at          | path | deprecated_kee                     | islast | id       |
+-------+---------------------------------------------------+---------+-------+-----------+------------+---------+----------+------------------+-----------+-----------+---------------------+------+------------------------------------+--------+----------+
| 12814 | NAME | DESC                                       |       1 | PRJ   | TRK       | PROJECTKEY |    NULL | NULL     |             NULL | NAME      |      NULL | 2014-07-08 16:57:46 | NULL | PROJECTKEY                         |      1 | 21507844 |
| 12814 | NAME | DESC                                       |       1 | PRJ   | TRK       | PROJECTKEY |    NULL | NULL     |             NULL | NAME      |      NULL | 2014-07-08 16:57:46 | NULL | PROJECTKEY                         |      1 | 21516010 |
+-------+---------------------------------------------------+---------+-------+-----------+------------+---------+----------+------------------+-----------+-----------+---------------------+------+------------------------------------+--------+----------+
2 rows in set (0.00 sec)

mysql> SELECT rootProject.id , s.islast, s.id, s.build_date    FROM projects p     INNER JOIN snapshots s ON s.project_id=p.id AND s.islast=true INNER JOIN projects rootProject ON rootProject.id=s.root_project_id AND p.kee='PROJECTKEY';
+-------+--------+----------+---------------------+
| id    | islast | id       | build_date          |
+-------+--------+----------+---------------------+
| 12814 |      1 | 21507844 | 2015-10-25 02:21:59 |
| 12814 |      1 | 21516010 | 2015-10-25 02:21:59 |
+-------+--------+----------+---------------------+
2 rows in set (0.01 sec)

删除SonarQube项目是唯一的解决方案(删除数据库条目会导致不同的错误)

答案 1 :(得分:0)

当我将声纳作为服务运行时出现此错误,当我从管理员命令提示符运行时,一切正常。