Sonarqube 扫描仪报告上传错误 500
Posted
技术标签:
【中文标题】Sonarqube 扫描仪报告上传错误 500【英文标题】:Sonarqube scanner report upload error 500 【发布时间】:2017-08-25 21:49:07 【问题描述】:每当我使用 SonarQube 项目属性创建一个新项目时,我都会收到此错误:
04:13:57.939 DEBUG: Upload report
04:14:11.533 DEBUG: POST 500 sonarserverurl/api/ce/submit?projectKey=Somename&projectName=Somename | time=13580ms
04:14:11.540 INFO: ------------------------------------------------------------------------
04:14:11.540 INFO: EXECUTION FAILURE
04:14:11.540 INFO: ------------------------------------------------------------------------
04:14:11.540 INFO: Total time: 2:25.443s
04:14:11.639 INFO: Final Memory: 56M/647M
04:14:11.639 INFO: ------------------------------------------------------------------------
04:14:11.639 ERROR: Error during SonarQube Scanner execution
org.sonarqube.ws.client.HttpException: Error 500 on sonarserver:9000/api/ce/submit?projectKey=Some name&projectName=Some name* : "errors":["msg":"An error has occurred. Please contact your administrator"]
at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:36)
at org.sonar.scanner.bootstrap.ScannerWsClient.failIfUnauthorized(ScannerWsClient.java:106)
at org.sonar.scanner.bootstrap.ScannerWsClient.call(ScannerWsClient.java:75)
at org.sonar.scanner.report.ReportPublisher.upload(ReportPublisher.java:177)
at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:131)
at org.sonar.scanner.phases.PublishPhaseExecutor.publishReportJob(PublishPhaseExecutor.java:71)
at org.sonar.scanner.phases.PublishPhaseExecutor.executeOnRoot(PublishPhaseExecutor.java:53)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:79)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:175)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:262)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:247)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
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:233)
at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
04:14:11.640 DEBUG: Execution getVersion
04:14:11.640 DEBUG: Execution stop
我的 sonar-project.properties 文件是:
sonar.host.url=http : // sonarqube_server:9000
sonar.projectKey=sonar.org:projectname
sonar.projectName=WP_projectname
sonar.projectVersion=1.0
sonar.exclusions=bower_components/**,public_html/bower_components/**
sonar.sources=.
【问题讨论】:
提供您正在使用的 SonarQube 版本,同时查看服务器日志,您应该会发现错误和堆栈跟踪 使用-X
标志运行声纳扫描仪,您将看到错误(POST 500)。不过不知道是什么原因造成的
【参考方案1】:
问题经常是SonarQube生成一个巨大的报告然后尝试一次性上传,导致HTTP 500,因为mysql拒绝接受这么大的请求体。
快速解决方法是更改服务器配置(my.ini
文件),以增加打包大小(从默认的 4MB,到您的报告大小):
[mysqld]
max_allowed_packet = 16M
每https://groups.google.com/forum/#!msg/sonarqube/c_DcwoN4qlg/wmnosoJkBAAJ
p.s.:您还需要重新启动 MySQL 和声纳服务以应用更改。
【讨论】:
遇到了完全相同的问题,这为我解决了。非常感谢重新启动 MySQL 和 SonarQube;最初只是重新启动了 MySQL,它仍然无法正常工作。重新启动两者都完成了工作:)【参考方案2】:我遇到了同样的问题,sonarqube-6.7.4/logs/web.log
中显示了以下错误消息:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: The size of BLOB/TEXT data
inserted in one transaction is greater than 10% of redo log size.
Increase the redo log size using innodb_log_file_size.
同样,最好的选择是减少报告存档的大小,不包括不相关的文件夹或文件。
顺便说一句,如果你真的需要为 30 MiB 压缩报告调整 MySQL,你可以在基于 Debian 的 Linux 系统上创建 /etc/mysql/conf.d/sonarqube.cnf
内容:
# Work-around Sonarqube large report storage trouble
[mysqld]
innodb_log_file_size = 150994944
参考:https://dev.mysql.com/doc/refman/5.6/en/innodb-parameters.html#sysvar_innodb_log_file_size
【讨论】:
【参考方案3】:我遇到了同样的问题。我已经解决了这个问题,而不是更改 my.ini 文件,我已经从声纳中排除了一个不必要的文件夹。您可以从管理设置选项卡中执行此操作。
【讨论】:
以上是关于Sonarqube 扫描仪报告上传错误 500的主要内容,如果未能解决你的问题,请参考以下文章
SonarQube 扫描仪执行错误 [Windows - Linux Master-Slave]
ANT 任务:使用 JaCoCo 的 SonarQube 扫描仪代码覆盖率报告