sonarqube msbuild runner NullPointerException - sonarqube

i'm trying to run SonarQube.Scanner.MSBuild locally from command prompt and I receive always same error above no matter what project i build.
Sonar server is remotly and reachable via web interface.
I'm building .NET(C#) projects, for .NET4.0 adn 4.5, I have .NET 4.5 to 4.6.2 installed locally.
Sonar server is version 6.1, because i'm just testing I'm using very basic configuration, internal DB used.
Error received during end phase (SonarQube.Scanner.MSBuild.exe end)
any idea?
-----------
14:04:57.429 INFO: EXECUTION FAILURE
14:04:57.429 INFO: -------------------------------------------------------------
-----------
14:04:57.429 INFO: Total time: 5.475s
14:04:57.460 INFO: Final Memory: 41M/106M
14:04:57.460 INFO: -------------------------------------------------------------
-----------
14:04:57.460 ERROR: Error during SonarQube Scanner execution
java.lang.NullPointerException
at org.sonar.plugins.csharp.sarif.SarifParser10.handleIssue(SarifParser1
0.java:69)
at org.sonar.plugins.csharp.sarif.SarifParser10.handleIssues(SarifParser
10.java:56)
at org.sonar.plugins.csharp.sarif.SarifParser10.parse(SarifParser10.java
:48)
at org.sonar.plugins.csharp.CSharpSensor.importRoslynReport(CSharpSensor
.java:291)
at org.sonar.plugins.csharp.CSharpSensor.analyse(CSharpSensor.java:113)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecuto
r.java:57)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java
:49)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseE
xecutor.java:78)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanCon
tainer.java:182)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentC
ontainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer
.java:127)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer
.java:247)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectSc
anContainer.java:242)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectSc
anContainer.java:240)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanC
ontainer.java:232)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentC
ontainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer
.java:127)
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(ComponentC
ontainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer
.java:127)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContain
er.java:115)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:118)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.exec
ute(BatchIsolatedLauncher.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:233)
at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScann
er.java:151)
at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110)
at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
14:04:57.460 ERROR:
14:04:57.476 ERROR: Re-run SonarQube Scanner using the -X switch to enable full
debug logging.
Process returned exit code 1
The SonarQube Scanner did not complete successfully
14:04:57.492 Creating a summary markdown file...
14:04:57.492 Post-processing failed. Exit code: 1

I had the same error with Version 6.1. After i changed my SonarQube Server to Version 5.6.3 i was able to analyze my project succesfully.
For testing: stop 6.1 server, unzip and start 5.6.3

Related

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

org.sonar.runner.kevinsawicki.HttpRequest$HttpRequestException

I've installed Sonarqube on my Docker container.
It was working very well up to a point, and I able to access it from the Web UI.
I'm a running it like this:
sonar.sh start
sonar-runner -e
However, out of the blue I am getting
SonarQube Runner 2.4
Java 1.8.0_111 Oracle Corporation (64-bit)
Linux 4.4.27-moby amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: /root/sonar-runner-2.4/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Work directory: /root/sonarqube-6.2/bin/linux-x86-64/./.sonar
ERROR: Sonar server 'http://localhost:9000' can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.104s
Final Memory: 1M/31M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.kevinsawicki.HttpRequest$HttpRequestException: java.net.ConnectException: Connection refused (Connection refused)
at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1392)
at org.sonar.runner.kevinsawicki.HttpRequest.ok(HttpRequest.java:1417)
at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:93)
at org.sonar.runner.impl.ServerVersion.downloadVersion(ServerVersion.java:47)
at org.sonar.runner.impl.ServerVersion.version(ServerVersion.java:38)
at org.sonar.runner.impl.ServerVersion.is37Compatible(ServerVersion.java:58)
at org.sonar.runner.impl.JarDownloader.checkVersionAndDownload(JarDownloader.java:36)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:71)
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:100)
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:53)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1390)
... 15 more
Sonarqube logs have the following 4 errors:
ce.log:2017.01.31 13:22:29 ERROR ce[][o.s.s.c.t.CeWorkerCallableImpl] Failed to pop the queue of analysis reports
sonar.log:2017.01.31 18:13:00 ERROR app[][o.s.p.m.Monitor] Process[web] failed to start
web.2017-01-30.log:2017.01.30 18:25:59 ERROR web[AVnwoF863qSCVt7PAAAA][o.s.s.ui.JRubyFacade] Fail to render: http://localhost:9000/
web.log:2017.01.31 18:13:00 ERROR web[][o.a.c.c.StandardContext] Context [] startup failed due to previous errors
I am really surprised by this, since I haven't changed anything. I only added a jar to /extensions/plugins/ and then I deleted it.
What's the cause of this error?
As reflected by your server log excerpts, the connection to your SonarQube server is refused because it is not online. Why? Because
failed to start
and
startup failed due to previous errors
Get your server up and running. Then you'll be able to perform analysis.

SonarQube Nullpointer on analysis, missing fields or rules parameters

I'm running into a nullpointer exception when running analysis on a java project.
The condition that triggers the analysis failure only happens when I activate certain Rules in the Quality Profile. Particularly, any rule that has a parameter you can override, causes the nullpointer failure. It fails whether or not I provide an override value or if the parameter is left default.
I should note that I can get successful analysis to complete if those particular rules are deactivated in the quality profile. It only seems to be related to certain rules that have parameters.
I can replicate this Nullpointer failure with both the sonar-runner, and the org.sonarqube gradle plugin (v 1.0). So I suspect it is not a problem with the runner or the plugin but some kind of setup issue with the SonarQube server and/or database.
The problem is, I don't know how to go in and fix this issue. The SonarQube database isn't documented (that I'm aware) I suspect that there is something maybe missing in the database but I'm not even sure where they might be.
Any suggestions on where I might look?
Versions:
SonarQube 4.5.2
SonarQube Runner 2.4
Java 1.8.0_40 Oracle Corporation (64-bit)
Mac OS X 10.10.4 x86_64
Here is the stack trace of the error:
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1:43.316s
Final Memory: 27M/635M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
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:100)
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:53)
Caused by: java.lang.NullPointerException
at org.sonar.api.batch.rule.Checks.getField(Checks.java:180)
at org.sonar.api.batch.rule.Checks.configureFields(Checks.java:167)
at org.sonar.api.batch.rule.Checks.instantiate(Checks.java:152)
at org.sonar.api.batch.rule.Checks.addAnnotatedChecks(Checks.java:127)
at org.sonar.java.SonarComponents.registerTestCheckClasses(SonarComponents.java:128)
at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:82)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:119)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:194)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:233)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:221)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
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:497)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
We solved the problem, and the problem was indeed the Java plugin on the SonarQube server. The solution was to downgrade the Java plugin though. Here are the versions we ended up using:
Checkstyle [checkstyle] 2.2 Analyze Java code with Checkstyle.
Clover [clover] 3.0 Get code coverage with Atlassian Clover.
Cobertura [cobertura] 1.6.3 Get code coverage with Cobertura.
Findbugs [findbugs] 3.1 Analyze Java code with Findbugs 3.0.0.
Java [java] 2.9.1 SonarQube rule engine.
JIRA [jira] 1.2 Connects SonarQube to Atlassian JIRA in various ways.
LDAP [ldap] 1.4 Delegates authentication to LDAP.
PMD [pmd] 2.3 Analyze Java code with PMD.

Read timed out on SonarQube analysis

We previously discussed the problem on the now closed SonarQube Users mailing list.
The problem was solved by exchanging the for about half a week by optimizing the Postgre DB, then the problem reoccured.
We are using Jenkins 1.612 using the SonarQube Jenkins Plugin 2.2.1, Sonar 5.1 using a Postgre 9.1 database.
We are running about 20 JAVA projects/branches using much legacy code and having about 1.2 million LOC and 130k issues.
There are about 30 JAVA projects module projects having 1k-20k LOC and less than 2k issues.
There are about 50 custom JAVA projects having less than 200k LOC and less than 10k issues.
Our projects are written in JAVA (6/7) and using ANT 50% or Gradle 50% as build tools.
Now we are getting this error again:
Gestartet durch vorgelagertes Projekt "Project__Branch__ant__dbTest", Build 86
originally caused by:
Gestartet durch vorgelagertes Projekt "Project__Branch__ant__build", Build 101
originally caused by:
Build wurde durch eine SCM-Änderung ausgelöst.
Baue auf Slave SonarQube (Sonar-Analyse) in Arbeitsbereich D:\Jenkins (prod-test)\workspace\Project__Branch__ant__sonar
Restoring workspace from build #101 of project Project__Branch__ant__build
[Project__Branch__ant__sonar] $ "D:\Jenkins (prod-test)\tools\hudson.plugins.sonar.SonarRunnerInstallation\sonar-runner-2.4\bin\sonar-runner.bat" -e -Dsonar.jdbc.url=jdbc:postgresql://localhost:5432/postgres ******** ******** -Dsonar.host.url=http://sonarqube:9000 ******** ******** "-Dsonar.projectBaseDir=D:\Jenkins (prod-test)\workspace\Project__Branch__ant__sonar" -Dsonar.branch=Branch
D:\Jenkins (prod-test)\tools\hudson.plugins.sonar.SonarRunnerInstallation\sonar-runner-2.4
SonarQube Runner 2.4
Java 1.7.0_45 Oracle Corporation (64-bit)
Windows Server 2008 R2 6.1 amd64
SONAR_RUNNER_OPTS=-Xmx2048m -XX:MaxPermSize=256m
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: D:\Jenkins (prod-test)\tools\hudson.plugins.sonar.SonarRunnerInstallation\sonar-runner-2.4\conf\sonar-runner.properties
INFO: Project configuration file: D:\Jenkins (prod-test)\workspace\Project__Branch__ant__sonar\sonar-project.properties
INFO: Default locale: "de_DE", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: D:\Jenkins (prod-test)\workspace\Project__Branch__ant__sonar\.sonar
INFO: SonarQube Server 5.1
02:22:57.131 INFO - Load global repositories
02:22:59.624 INFO - Load global repositories (done) | time=2533ms
02:22:59.642 INFO - Server id: 20150601083800
02:22:59.650 INFO - User cache: C:\.sonar\cache
02:22:59.768 INFO - Install plugins
02:23:05.720 INFO - Install JDBC driver
02:23:05.781 INFO - Create JDBC datasource for jdbc:postgresql://localhost:5432/postgres
02:23:14.096 INFO - Initializing Hibernate
02:23:28.270 INFO - Load project repositories
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1:05.593s
Final Memory: 38M/269M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
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:100)
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:53)
Caused by: java.lang.IllegalStateException: Unable to request: /batch/project?key=Project%3ABranch&preview=false
at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:109)
at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:99)
at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:87)
at org.sonar.batch.repository.DefaultProjectRepositoriesLoader.load(DefaultProjectRepositoriesLoader.java:55)
at org.sonar.batch.repository.ProjectRepositoriesProvider.provide(ProjectRepositoriesProvider.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:631)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:677)
at org.sonar.api.platform.ComponentContainer.getComponentByType(ComponentContainer.java:209)
at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:92)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Caused by: java.net.SocketTimeoutException: Read timed out
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:298)
at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:255)
at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:105)
... 59 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1323)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2678)
at java.net.URLConnection.getContentEncoding(URLConnection.java:533)
at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:296)
... 61 more
ERROR:
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone SonarQube Analysis' marked build as failure
Sending e-mails to: ****#****.**
Notifying upstream projects of job completion
Finished: FAILURE
I hope you may help finding a solution for this problem. Thx.
Edit: Operability restored:
Found a workaround if triggered from Jenkins.
At this link there was a similar issue for an older Sonar version. They triggered regularly the URL to keep the query in DB cache. This works for this issue also.
In Jenkins I installed the http Request plugin and before issuing the sonar analysis I trigger a http get on http://mySonarQube:9000/batch/project?key=myProjectKey&preview=false . This works around the real problem (DB request duration and timeout interval don't fit), but it may keep us operable.
In the next few days Sonar 5.2 will occur. We will test this version and I hope there the issues will be gone... I'll report...
https://jira.sonarsource.com/projects/SONAR/versions/11629
The problem can be solved in 4 ways:
add more resources to SonarQube server process and/or server platform (e.g. faster disks)
upgrade SonarQube server to the newest version (e.g. a lot of performance problems have been fixed in SonarQube 5.2 - see release notes)
change timeout value in sources and compile custom server
add indexes on columns in database (not recommended, you can read executed SQL commands from logs in debug mode)

Sonar, Gendarme plugin issue

I'm new in sonar.
I have problems when I use gendarme rules, but without those rules, it works
fine.
This is the error in debug mode (sonar-runner -X):
14:19:22.637 DEBUG - No assembly specified: will look into 'csproj' files to
find which should be analyzed.
14:19:22.638 DEBUG - Fallback to directory
C:\Users\soaint002\Documents\Visual Studio
2010\Projects\WindowsFormAlan\.\WindowsFormAlan\bin\Debug for project
WindowsFormAlan
14:19:22.638 DEBUG - - Gendarme program : C:\Program Files
(x86)\gendarme-2.10-bin\gendarme.exe
14:19:22.639 DEBUG - - Config file :
C:\Users\soaint002\Documents\Visual Studio
2010\Projects\WindowsFormAlan\WindowsFormAlan\.sonar\sonar.Gendarme
14:19:22.639 DEBUG - - Report file :
C:\Users\soaint002\Documents\Visual Studio
2010\Projects\WindowsFormAlan\WindowsFormAlan\.sonar\gendarme-report.xml
14:19:22.639 DEBUG - - Quiet output
14:19:22.639 DEBUG - - Confidence : normal+
14:19:22.639 DEBUG - - Severity : all
14:19:22.640 DEBUG - - Scanned assemblies :
14:19:22.640 DEBUG - o C:\Users\soaint002\Documents\Visual Studio
2010\Projects\WindowsFormAlan\.\WindowsFormAlan\bin\Debug\WindowsFormAlan.exe
14:19:22.640 INFO - Executing command: C:\Program Files
(x86)\gendarme-2.10-bin\gendarme.exe --config
C:\Users\soaint002\Documents\Visual Studio
2010\Projects\WindowsFormAlan\WindowsFormAlan\.sonar\sonar.Gendarme -
-xml C:\Users\soaint002\Documents\Visual Studio
2010\Projects\WindowsFormAlan\WindowsFormAlan\.sonar\gendarme-report.xml
--quiet --confidence normal+ --severity all
C:\Users\soaint002\Documents\Visual Studio 2010\Pr
ojects\WindowsFormAlan\.\WindowsFormAlan\bin\Debug\WindowsFormAlan.exe
14:19:22.770 INFO -
14:19:22.771 INFO - An uncaught exception occured. Please fill a bug report
at https://bugzilla.novell.com/
14:19:22.772 INFO - Stack trace: System.Xml.XmlException: The value 'null'
could not be converted into the property MaximumDepth type for rule
AvoidDeepInheritanceTreeRule. Review your configuration file.
14:19:22.772 INFO - at Gendarme.Settings.SetCustomParameters(XmlNode
nodes)
14:19:22.772 INFO - at Gendarme.Settings.Load()
14:19:22.772 INFO - at Gendarme.ConsoleRunner.Execute(String[] args)
14:19:22.779 DEBUG - Release semaphore on project :
org.sonar.api.resources.Project#3da72e31[id=1092,key=SAS:WindowsFormSAlan,qualifier=TRK],
with key batch-SAS:WindowsFormSAlan
14:19:22.838 DEBUG - To prevent a memory leak, the JDBC Driver
[com.mysql.jdbc.Driver] has been forcibly deregistered
INFO:
------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO:
------------------------------------------------------------------------
Total time: 6.848s
Final Memory: 15M/341M
INFO:
------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
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:100)
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:53)
Caused by: org.sonar.api.utils.SonarException: Gendarme execution failed.
at
org.sonar.plugins.csharp.gendarme.GendarmeSensor.analyse(GendarmeSensor.java:175)
at
org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
at
org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
at
org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:131)
at
org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:178)
at
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at
org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:199)
at
org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:194)
at
org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:192)
at
org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:187)
at
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:56)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:44)
at
org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
at
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at
org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:175)
at
org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:163)
at
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
at
org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Caused by: org.sonar.dotnet.tools.gendarme.GendarmeException: Gendarme
analysis failed: execution was interrupted by a non-handled exception. This
is likely a bug inside Gendarme and should be reported on Novell's b
ugzilla (http://bugzilla.novell.com) or on the mailing-list.
at
org.sonar.dotnet.tools.gendarme.GendarmeRunner.execute(GendarmeRunner.java:124)
at
org.sonar.plugins.csharp.gendarme.GendarmeSensor.launchGendarme(GendarmeSensor.java:221)
at
org.sonar.plugins.csharp.gendarme.GendarmeSensor.analyse(GendarmeSensor.java:173)
sonar-project.properties:
# Required metadata
sonar.projectKey=SAS:WindowsFormSAlan
sonar.projectName=WindowsFormSAlan
sonar.projectVersion=1.2
# Comma-separated paths to directories with sources (required)
sonar.sources=.
# Language
sonar.language=cs
sonar.gallio.mode=skip
# Encoding of the source files
sonar.sourceEncoding=UTF-8
I have the following list of plugins installed. Do I need to install other plugins too?
sonar-csharp-plugin-3.1
sonar-dotnet-gendarme-plugin-2.0
sonar-dotnet-ndeps-plugin-2.0
sonar-dotnet-plugin-2.0
All dotnet plugins version must have they same version.
If not the will be not compatible.

Resources