1

我已经使用 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

4 回答 4

2

在我的声纳中,它不会将二进制数据放入 MySQL,所以我改变了

max_allowed_pa​​cket = 16M 到

#max_allowed_pa​​cket = 256M

于 2016-10-21T11:44:57.487 回答
1

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

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

于 2016-07-15T15:08:47.623 回答
0

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

于 2016-12-15T13:38:42.520 回答
0

它对我有用:在 Jenkins 中,转到 Global Tool Configuration 并查找 SonarQube Scanner 块。激活它。错误将消失。

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

于 2016-07-20T12:25:15.377 回答