SonarQube + Jenkins错误500

时间:2016-07-11 16:55:15

标签: jenkins sonarqube jenkins-plugins sonarqube-scan

我已经使用Jenkins的SonarQube插件成功集成了SonarQube和Jenkins。声纳分析似乎是成功的,但我无法在声纳仪表板上看到结果。这是堆栈跟踪:

INFO: Sensor SCM Sensor
INFO: SCM provider for this project is: git
INFO: 6 files to be analyzed
INFO: 6/6 files analyzed
INFO: Sensor SCM Sensor (done) | time=343ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=12ms
INFO: Sensor Code Colorizer Sensor
INFO: Sensor Code Colorizer Sensor (done) | time=1ms
INFO: Sensor CPD Block Indexer
INFO: JavaCpdBlockIndexer is used for java
INFO: Sensor CPD Block Indexer (done) | time=20ms
INFO: Calculating CPD for 6 files
INFO: CPD calculation finished
INFO: Analysis report generated in 65ms, dir size=39 KB
INFO: Analysis reports compressed in 187ms, zip size=23 KB
INFO:         ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 4.083s
INFO: Final Memory: 50M/385M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
org.sonarqube.ws.client.HttpException: Error 500 on http://localhost:9000/api/ce/submit?projectKey=helloworld&projectName=Simple%20Java%20project%20analyzed%20with%20the%20SonarQube%20Runner
at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:34)
at org.sonar.batch.bootstrap.BatchWsClient.failIfUnauthorized(BatchWsClient.java:99)
at org.sonar.batch.bootstrap.BatchWsClient.call(BatchWsClient.java:69)
at org.sonar.batch.report.ReportPublisher.upload(ReportPublisher.java:172)
at org.sonar.batch.report.ReportPublisher.execute(ReportPublisher.java:127)
at org.sonar.batch.phases.PublishPhaseExecutor.publishReportJob(PublishPhaseExecutor.java:64)
at org.sonar.batch.phases.PublishPhaseExecutor.executeOnRoot(PublishPhaseExecutor.java:51)
at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:86)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:240)
at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110)
at org.sonarsource.scanner.cli.Main.execute(Main.java:72)
at org.sonarsource.scanner.cli.Main.main(Main.java:60)

当我点击链接时,它会显示

 {"errors":[{"msg":"HTTP method POST is required"}]}

我认为解决方案是重新配置SQ,因此它直接使用目标URL,但我该怎么做?

4 个答案:

答案 0 :(得分:2)

在我的声纳中,它没有将二进制数据放到MySQL中,所以我改变了

max_allowed_pa​​cket = 16M to

#max_allowed_pa​​cket = 256M

答案 1 :(得分:1)

我遇到了同样的错误,Nicolas'关于检查sonar.log的评论帮我诊断了问题。我在Windows上将其作为Windows服务运行,并且该进程的用户设置为默认本地服务,因此它在C:\ Windows \ System32下查找临时文件夹。我将用户帐户更改为实际用户帐户,这解决了问题。

如果日志中的错误无法找到临时文件夹,请尝试检查运行Sonar的用户帐户。

答案 2 :(得分:0)

对我有用: 在Jenkins中,转到全局工具配置并查找SonarQube扫描程序块。 激活它。错误将消失。

https://gabrielscavassa.wordpress.com/2016/07/21/jenkins-sonarqube/

答案 3 :(得分:0)

我有类似的问题,解决方案是主机参数是以'http'而不是'https'格式给出的,这导致重定向失去了POST信息