【问题标题】:Sonar - Fail to request server version | HTTP Status 404 /Sonar - 请求服务器版本失败 | HTTP 状态 404 /
【发布时间】:2018-06-20 04:13:05
【问题描述】:

控制台或 Jenkins 每次运行都会引发以下错误:

SonarQube Runner 2.4
Java 1.8.0_51 Oracle Corporation (32-bit)
Linux 2.6.32-504.30.3.el6.i686 i386
INFO: Runner configuration file: /usr/local/sonar-runner/conf/sonar-runner.properties
INFO: Project configuration file: /opt/apps/php-sonar-runner/sonar-project.properties
INFO: Default locale: "es_ES", source code encoding: "UTF-8"
INFO: Work directory: /opt/apps/php-sonar-runner/./.sonar
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.042s
Final Memory: 0M/28M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Fail to request server version
ERROR: Caused by: Status returned by url : 'http://xxx.xxx.xx.xxx:9000/api/server/version' is invalid : 404
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.

【问题讨论】:

标签: sonarqube


【解决方案1】:

在浏览器中打开 URL 'http://xxx.xxx.xx.xxx:9000/api/server/version',看看它是否给你一个 404 错误。如果是这样,您需要在远程服务器上找到Sonar root 的正确路径,可能是'http://xxx.xxx.xx.xxx:9000/sonar/'?

当您拥有 Sonar 的完整 URL 后,相应地更新您的 pom 中的 sonar.host.url 属性。详情请见full documentation

【讨论】:

  • 我可以在浏览器中访问该网址,但在 jenkins 中运行构建时会出现问题。
【解决方案2】:

检查sonar.web.context = /myPath 的值也许你有一些路径,你在你的jenkis、tfs等的url中配置了其他路径。这就是你得到404错误的原因。

在您的示例中,您不应配置该值或没有该值。

'http://xxx.xxx.xx.xxx:9000/myPath/api/server/version

【讨论】:

    【解决方案3】:

    在您的sonar-runner.properties 文件中

    define #--- 默认 SonarQube 服务器如下所示

    sonar.host.url=http://localhost:9000/sonar
    

    同时交叉检查sonar.properties文件,即

    sonar.web.port=9000
    sonar.web.host=127.0.0.1
    sonar.web.context=/sonar
    

    【讨论】:

      猜你喜欢
      • 2014-09-13
      • 2013-04-10
      • 1970-01-01
      • 2012-05-03
      • 1970-01-01
      • 2022-11-13
      • 2012-06-27
      • 2021-10-06
      • 2020-09-18
      相关资源
      最近更新 更多