Sonarqube扫描仪报告上传错误500

时间:2017-03-31 14:58:59

标签: sonarqube sonarqube-scan

每当我使用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=.

3 个答案:

答案 0 :(得分:29)

问题经常是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和声纳服务才能应用更改。

答案 1 :(得分:1)

我遇到了同样的问题。我已经解决了这个问题而不是更改 my.ini 文件我从声纳中排除了一个不必要的文件夹。您可以从管理设置选项卡执行此操作。

答案 2 :(得分:1)

我在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