Sonarqube scanner report upload error 500 - sonarqube

When every I create a new project with SonarQube project properties, I get this error:
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
My sonar-project.properties file is:
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=.

The problem often is that SonarQube generates a huge report and then tries to upload it in one shot, causing HTTP 500, because MySQL refuses to accept such a large request body.
The quick fix is to change the server config (my.ini file), to increase packed size (from default 4MB, to whatever is your report size):
[mysqld]
max_allowed_packet = 16M
per https://groups.google.com/forum/#!msg/sonarqube/c_DcwoN4qlg/wmnosoJkBAAJ
p.s.: you will also need to restart both MySQL and sonar services to apply changes.

I faced same issue with following error message visible in 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.
Again, best option is to reduce report archives size excluding non relevant folders or files.
By the way, if you really have to tune MySQL for 30 MiB compressed reports, you may create /etc/mysql/conf.d/sonarqube.cnf on Debian-based Linux system with content:
# Work-around Sonarqube large report storage trouble
[mysqld]
innodb_log_file_size = 150994944
Reference: https://dev.mysql.com/doc/refman/5.6/en/innodb-parameters.html#sysvar_innodb_log_file_size

I had the same problem. I have resolved that issue instead of changing in my.ini file I have excluded an unnecessary folder from sonar. You can do that from the administration setting tab.

Related

Error during SonarQube Scanner execution with sonar python enabled

I am a very new sonarqube user, experimenting with my python project.
I have installed docker Sonarqube image which has Sonarpython plugin installed. I installed the linux base sonar scanner.
Using these instructions, I configured the scanner.
However when running it, I run into:
11:28:33.486 INFO: Configured Java source version (sonar.java.source): none
11:28:33.496 INFO: JavaClasspath initialization
11:28:33.512 INFO: ------------------------------------------------------------------------
11:28:33.512 INFO: EXECUTION FAILURE
11:28:33.512 INFO: ------------------------------------------------------------------------
11:28:33.513 INFO: Total time: 22.237s
11:28:33.670 INFO: Final Memory: 28M/509M
11:28:33.671 INFO: ------------------------------------------------------------------------
11:28:33.671 ERROR: Error during SonarQube Scanner execution
org.sonar.java.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property
at org.sonar.java.JavaClasspath.init(JavaClasspath.java:66)
at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:280)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:175)
at org.sonar.java.JavaSquid.<init>(JavaSquid.java:82)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:91)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:359)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:354)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:317)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
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:185)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Do I need to configure sonar.java.source to successfully scan?
As soon as you are having some Java sources in your project, SonarQube is going to ask you for the compiled binaries as well in order to perform the analysis. It let you with 2 choices:
If you want to focus on Python code only, then ignore java code by properly excluding it with the following scanner property: sonar.exclusions=**/*.java. For more information regarding exclusions, you can have a look at this page: SonarQube 7.7 - Narrowing the focus. Another way could be to only include python files, which would ignore all the other one. We however recommend to have the broader analysis possible.
If you want to also analyse your Java code, then build your project first, and provide the path to your binaries and libraries (optional) using the following properties: sonar.java.binaries and sonar.java.libraries. Refer to this documentation page for configuration: Java Plugin and Bytecode

Sonarqube scanner error DirectoryNotEmptyException

I am using sonarqube scanner on a Citrix remote machine. During the scan, analysis of code completes and gets zipped. But while uploading this zipped file, I get java.nio.file.DirectoryNotEmptyException and nothing gets uploaded to the sonarqube server.
Note that the scanner works fine for small projects. It does not work only for large projects. My sonarqube version is 7.2.1. Same thing happened in version 6.7 LTS. But it worked perfectly fine in version 5.6 LTS.
I have tried setting sonar.ws.timeout=9000 in sonar-scanner.properties file to increase time. This did not work.
The error message is:
INFO: 7 files had no CPD blocks
INFO: Calculating CPD for 521 files
INFO: CPD calculation finished
INFO: Analysis report generated in 4886ms, dir size=15 MB
INFO: Analysis reports compressed in 3769ms, zip size=4 MB
ERROR: Failed to delete temp folder
java.nio.file.DirectoryNotEmptyException: C:\codeAnalyzer\bhatk\.scannerwork\.sonartmp
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProv
ider.java:266)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSyst
emProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at org.sonar.api.utils.internal.DefaultTempFolder$DeleteRecursivelyFileV
isitor.postVisitDirectory(DefaultTempFolder.java:121)
at org.sonar.api.utils.internal.DefaultTempFolder$DeleteRecursivelyFileV
isitor.postVisitDirectory(DefaultTempFolder.java:110)
at java.nio.file.Files.walkFileTree(Files.java:2688)
at java.nio.file.Files.walkFileTree(Files.java:2742)
at org.sonar.api.utils.internal.DefaultTempFolder.clean(DefaultTempFolde
r.java:97)
at org.sonar.api.utils.internal.DefaultTempFolder.stop(DefaultTempFolder
.java:106)
at org.sonar.scanner.analysis.AnalysisTempFolderProvider.stop(AnalysisTe
mpFolderProvider.java:61)
at org.picocontainer.DefaultPicoContainer.stopAdapters(DefaultPicoContai
ner.java:1048)
at org.picocontainer.DefaultPicoContainer.stop(DefaultPicoContainer.java
:803)
at org.sonar.core.platform.ComponentContainer.stopComponents(ComponentCo
ntainer.java:165)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer
.java:124)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:
81)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentC
ontainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer
.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContain
er.java:132)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.exec
ute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(Iso
latedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner
.java:171)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.j
ava:128)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 3:27.575s
INFO: Final Memory: 60M/2882M
INFO: -----------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Fail to request http://localhost:9000/api/ce/submit?projectKey=my:project
&projectName=My%20project
ERROR: Caused by: timeout
ERROR: Caused by: Socket closed
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging
.
the error caused by default 10s writeTimeout inherited from OkHttp library. While readTimeout is configurable by sonar.ws.timeout param, the writeTimout is not currently configurable. In some cases, depends on the analysis report size and /or your infrastructure setup, 10s is not enough to upload an analysis report that causes socket timeout error and DirectoryNotEmptyException. I have implemented a fix and committed it to SonarSource github: https://github.com/SonarSource/sonarqube/pull/3252/files

SonarQube upgrade from 6.4 to 6.5 breaks the scanner

I am on sonarQube6.4 and have upgraded to 6.5
Sonar-scanner is 3.0.3
Now after the upgrade the scanner fails anytime there is a java file in the source path. If I don't scan java files everything works just fine.
However If I rollback an use 6.4 version, everything works fine, so is there any regression? This is the stack trace, when I run the scanner command with -X command. So is it a mandate in 6.5 to provided the location of all compiled classed, is there a way to ignore it.
04:56:21.218 DEBUG: Sensors : JavaSquidSensor -> SurefireSensor ->
JaCoCoSensor -> SonarJavaXmlFileSensor -> Analyzer for "php.ini" files
-> Zero Coverage Sensor -> CPD Block Indexer 04:56:21.218 INFO: Sensor JavaSquidSensor [java] 04:56:21.558 INFO: Configured Java source
version (sonar.java.source): none 04:56:21.565 INFO: JavaClasspath
initialization 04:56:21.570 INFO:
------------------------------------------------------------------------ 04:56:21.571 INFO: EXECUTION FAILURE 04:56:21.571 INFO:
------------------------------------------------------------------------ 04:56:21.571 INFO: Total time: 6.545s 04:56:21.707 INFO: Final Memory:
51M/1083M 04:56:21.707 INFO:
------------------------------------------------------------------------ 04:56:21.707 ERROR: Error during SonarQube Scanner execution
org.sonar.squidbridge.api.AnalysisException: Please provide compiled
classes of your project with sonar.java.binaries property
at org.sonar.java.JavaClasspath.init(JavaClasspath.java:59)
at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:281)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:141)
at org.sonar.java.JavaSquid.(JavaSquid.java:83)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:83)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:179)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:261)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:256)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:245)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:119)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:116)
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:56:21.710 DEBUG: Execution getVersion 04:56:21.711 DEBUG: Execution
stop
When I run the same with 6.4, it works fine and the only warning I see in the console is :
04:52:42.738 WARN: Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property
Error during SonarQube Scanner execution
org.sonar.squidbridge.api.AnalysisException: Please provide compiled
classes of your project with sonar.java.binaries property
Since SonarJava 4.12, you must specify sonar.java.binaries property https://docs.sonarqube.org/display/PLUG/Java+Plugin+and+Bytecode
Example :
sonar-scanner -Dsonar.projectKey=fr.demo:my-project -Dsonar.sources=. -Dsonar.java.binaries=.
The error message says:
Error during SonarQube Scanner execution org.sonar.squidbridge.api.AnalysisException:
Please provide compiled classes of your project with sonar.java.binaries property
It seems like the java sensor requires the .class files, in addition to the .java files.
You could:
Add those files to the analysis (it will by the way give you more valuable sonar findings!)
Try adding and removing files to find out, which piece of code causes the issue and report it as a Sonar Java bug
I had this issue as well and I fixed it in the following way:
This page mentions about an entry which was optional before and became mandatory during the latest update (4.12). It says that the sonar.java.binaries entry in the Jenkins project settings should be set. When set, even to a faulty folder, it will fix your errors, leaving only a warning and your pipeline will be running again.
The setting should be added to Jenkins -> "your project" -> Configuration -> Build -> Execute SonarQube Scanner -> Analysis Properties. Add this entry and point it to your binaries folder.
Even i was also facing same issue after SonarQube upgrade to latest 6.5 version. But after downgrading SonarJava plugin(from 4.12 to 4.11), it worked.
Hope it will help you.

SonarQube failed to complete the review of this commit: unable to retrive author for commit [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I can't find anything about this online at all. The only search returns are from the source code itself.
https://www.google.com/search?site=&source=hp&q=%22unable+to+create+retrive+author%22&oq=%22unable+to+create+retrive+author%22&gs_l=psy-ab.3..33i22i29i30k1l4.4603.10463.0.10991.41.19.0.0.0.0.984.2208.0j2j1j5-1j1.5.0....0...1.1.64.psy-ab..36.3.1063...0.O7TJHAo3Irg
The title states what the problem is. I've never seen this error, but now it occurs for every pipeline I run. I don't know why or when it started. If I figure this out I'll post solution.
I'll check SonarQube permissions and try to make sure everything is configured properly.
17:07:07.624 INFO: ANALYSIS SUCCESSFUL
17:07:07.625 DEBUG: IssuesSeverityBreaker is disabled (sonar.buildbreaker.preview.issuesSeverity == DISABLED)
17:07:07.625 DEBUG: QualityGateBreaker is disabled (sonar.analysis.mode != publish)
17:07:07.627 DEBUG: Post-jobs : GitLab Commit Issue Publisher (wrapped)
17:07:07.627 INFO: Executing post-job GitLab Commit Issue Publisher (wrapped)
17:07:07.757 ERROR: SonarQube failed to complete the review of this commit
java.lang.IllegalStateException: Unable to create retrive author for commit 7ee2dab421610f30a8b
at com.talanlabs.sonar.plugins.gitlab.CommitFacade.getUsernameForRevision(CommitFacade.java:228)
at com.talanlabs.sonar.plugins.gitlab.CommitIssuePostJob.updateGlobalComments(CommitIssuePostJob.java:177)
at com.talanlabs.sonar.plugins.gitlab.CommitIssuePostJob.execute(CommitIssuePostJob.java:72)
at org.sonar.scanner.postjob.PostJobWrapper.executeOn(PostJobWrapper.java:58)
at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:65)
at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:54)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:81)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:178)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:259)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:254)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
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:144)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
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)
Caused by: com.talanlabs.gitlab.api.GitLabAPIException: {"message":"403 Forbidden - Not authorized to access /api/v4/users"}
at com.talanlabs.gitlab.api.http.GitLabHTTPRequestor.handleAPIError(GitLabHTTPRequestor.java:378)
at com.talanlabs.gitlab.api.http.GitLabHTTPRequestor.toPaged(GitLabHTTPRequestor.java:149)
at com.talanlabs.gitlab.api.services.GitLabAPIUsers.getUsers(GitLabAPIUsers.java:59)
at com.talanlabs.sonar.plugins.gitlab.CommitFacade.getUsernameForRevision(CommitFacade.java:214)
... 32 common frames omitted
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://gitlab.company.com/api/v3/users?search=first.m.last%40company.com
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at com.talanlabs.gitlab.api.http.GitLabHTTPRequestor.parse(GitLabHTTPRequestor.java:336)
at com.talanlabs.gitlab.api.http.GitLabHTTPRequestor.toPaged(GitLabHTTPRequestor.java:144)
... 34 common frames omitted
17:07:07.839 INFO: Task total time: 12.279 s
17:07:07.839 INFO: ------------------------------------------------------------------------
17:07:07.839 INFO: EXECUTION SUCCESS
17:07:07.839 INFO: ------------------------------------------------------------------------
17:07:07.839 INFO: Total time: 15.686s
17:07:07.951 INFO: Final Memory: 49M/449M
17:07:07.951 INFO: ------------------------------------------------------------------------
17:07:07.951 DEBUG: Execution getVersion
17:07:07.951 DEBUG: Execution stop
Process returned exit code 0
The SonarQube Scanner has finished
17:07:08.303 Creating a summary markdown file...
17:07:08.303 Analysis results: http://server:9000/dashboard/index/ft-hzn-sps-db
17:07:08.304 Post-processing succeeded.
Creating cache default...
Created cache
Job succeeded
Here is what the logs tell us about your problem:
java.lang.IllegalStateException: Unable to create retrive author for commit 7ee2dab421610f30a8b
SonarQube tries to get an author of the git commit 7ee2dab421610f30a8b, because it uses that blame information to automatically assign issues and to show this kind of information in the UI. However retrieving the author does not work for these reason:
com.talanlabs.gitlab.api.GitLabAPIException: {"message":"403 Forbidden - Not authorized to access /api/v4/users"}
The framework, that is used to access this information in git tried to access an api, but got an authorization exception (http code 403).
Server returned HTTP response code: 403 for URL: https://gitlab.company.com/api/v3/users?search=first.m.last%40company.com
Something went wrong, when trying to search for a user with the email adress first.m.last#company.com (which seems to be a fake email address).
So to fix this issue, you should give the user that runs the SonarQube analysis sufficient privileges and you should check, that your git history does not contain unusual data.

Unable to run Sonar

I am trying to analyse my solution (C# .NET) using sonar. Unfortunately after plugins loading it is failing with following stacktrace:
14:53:19.646 DEBUG - Release semaphore on project : org.sonar.api.resources.Project#7f9b2bab[id=3169,key=com.exigenservices:cm,qualifier=TRK], with key batch-com.exigenservices:cm
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 2:12.629s
Final Memory: 13M/405M
ERROR: Error during Sonar runner execution
INFO: ------------------------------------------------------------------------
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:90)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:41)
Caused by: java.util.NoSuchElementException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:929)
at java.util.HashMap$ValueIterator.next(HashMap.java:954)
at org.sonar.dotnet.tools.commons.visualstudio.VisualStudioProject.getArtifactDirectory(VisualStudioProject.java:178)
at org.sonar.dotnet.tools.commons.visualstudio.VisualStudioProject.getArtifact(VisualStudioProject.java:195)
at org.sonar.dotnet.tools.commons.visualstudio.VisualStudioProject.getGeneratedAssemblies(VisualStudioProject.java:209)
at org.sonar.plugins.csharp.api.sensor.AbstractRegularCSharpSensor.assembliesFound(AbstractRegularCSharpSensor.java:101)
at org.sonar.plugins.csharp.api.sensor.AbstractRegularCSharpSensor.shouldExecuteOnProject(AbstractRegularCSharpSensor.java:81)
at org.sonar.plugins.csharp.api.sensor.AbstractRuleBasedCSharpSensor.shouldExecuteOnProject(AbstractRuleBasedCSharpSensor.java:48)
at org.sonar.batch.bootstrap.BatchExtensionDictionnary.shouldKeep(BatchExtensionDictionnary.java:62)
at org.sonar.batch.bootstrap.BatchExtensionDictionnary.getFilteredExtensions(BatchExtensionDictionnary.java:52)
at org.sonar.batch.bootstrap.BatchExtensionDictionnary.select(BatchExtensionDictionnary.java:42)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:63)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:150)
Actually in sonar cache (.sonar) directory presented following plugins:
checkstyle
core
cpd
csharp
csharpfxcop
csharpgallio
csharpgendarme
csharpndeps
csharpsquid
csharpstylecop
dbcleaner
design
emailnotifications
findbugs
jacoco
java
l10nen
mavenbatch
pmd
squidjava
surefire
Unfortunately I have not any idea hot to fix it and where is an issue due poorness of sonar debug messages.
The Visual Studio project parser in SonarQube's .Net plugins expect to find the output files using this xpath:
"/vst:Project/vst:PropertyGroup[contains(#Condition,'" + config + "')]/vst:OutputPath"
where config is the build configuration it has determined it should use.
From what I can tell looking at the current source code and the exception stack trace you provided (which don't line up exactly), the exception is getting thrown on this line:
if (artifactDirectory == null) {
// just take the first one found...
artifactDirectory = buildConfOutputDirMap.values().iterator().next();
which implies that it couldn't find any build output for your project.
If you find that your csproj file has a different location for the OutputPath, please submit a bug report to the SonarQube user mailing list so that it can be fixed in the future.
This means that the CSPROJ file of your project is not correct and is missing some information about the artifact directory where the assembly is generated.

Resources