Sonar-Runner not starting (c#) - sonarqube

When I start Sonar runner, I am getting this exception. It is not working and not starting. What can I do? Please help me ,thank you. (I am trying to configure Sonar 3.2 in my Windows 7 64 bit operating system)
C:\Users\ea\Desktop\sonar-runner-2.0\sonar-runner-2.0\bin>sonar-runner
ôSONAR_RUNNER_HOME = C:\Users\ea\Desktop\sonar-runner-2.0\sonar-runner-2.0\
bin\..ö
ôPROJECT_HOME = C:\Users\ea\Desktop\sonar-runner-2.0\sonar-runner-2.0\bin\.
.ö
Runner configuration file: C:\Users\ea\Desktop\sonar-runner-2.0\sonar-runne
r-2.0\bin\..\conf\sonar-runner.properties
Project configuration file: NONE
Runner version: 2.0
Java version: 1.7.0_07, vendor: Oracle Corporation
OS name: "Windows 7", version: "6.1", arch: "amd64"
Default locale: "en_US", source code encoding: "windows-1254" (analysis is platf
orm dependent)
Server: http://localhost:9000
Work directory: C:\Users\ea\Desktop\sonar-runner-2.0\sonarrunner 2.0\.sonar
13:59:34.477 [main] WARN o.s.r.i.batch.SonarProjectBuilder - /!\ The 'sources'
property is deprecated and is replaced by 'sonar.sources'. Don't forget to updat
e your files.
13:59:36.207 WARN .c.p.DefaultDatabase - H2 database should be used for evaluat
ion purpose only
13:59:36.207 INFO o.s.c.p.Database - Create JDBC datasource to url jdbc:h2:
tcp://localhost/sonar
13:59:37.390 INFO actDatabaseConnector - Initializing Hibernate
13:59:38.851 WARN StudioProjectBuilder - The specified '.sln' path does not poi
nt to an existing file: C:\Users\ea\Desktop\sonar-runner-2.0\sonar-runner-2
.0\bin\..\sinav_bildir
Total time: 7.632s
Final Memory: 7M/171M
Exception in thread "main" org.sonar.runner.RunnerException: org.picocontainer.P
icoLifecycleException: PicoLifecycleException: method 'public final void org.son
ar.api.batch.bootstrap.ProjectBuilder.start()', instance 'org.sonar.plugins.csha
rp.core.VisualStudioProjectBuilder#7986f7af, java.lang.RuntimeException: wrapper
at org.sonar.runner.Runner.delegateExecution(Runner.java:288)
at org.sonar.runner.Runner.execute(Runner.java:151)
at org.sonar.runner.Main.execute(Main.java:84)
at org.sonar.runner.Main.main(Main.java:56)
Caused by: org.picocontainer.PicoLifecycleException: PicoLifecycleException: met
hod 'public final void org.sonar.api.batch.bootstrap.ProjectBuilder.start()', in
stance 'org.sonar.plugins.csharp.core.VisualStudioProjectBuilder#7986f7af, java.
lang.RuntimeException: wrapper
at org.picocontainer.monitors.NullComponentMonitor.lifecycleInvocationFa
iled(NullComponentMonitor.java:77)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThr
owReflectionLifecycleException(ReflectionLifecycleStrategy.java:132)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(
ReflectionLifecycleStrategy.java:115)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(Reflect
ionLifecycleStrategy.java:89)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter
.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.j
ava:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Store
d.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(Defaul
tPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoConta
iner.java:1002)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.jav
a:760)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:70)
at org.sonar.batch.bootstrap.Module.start(Module.java:82)
at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.jav
a:121)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.Batch.execute(Batch.java:104)
at org.sonar.runner.internal.batch.Launcher.executeBatch(Launcher.java:6
9)
at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:61)
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.Runner.delegateExecution(Runner.java:285)
... 3 more
Caused by: java.lang.RuntimeException: wrapper
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThr
owReflectionLifecycleException(ReflectionLifecycleStrategy.java:130)
... 24 more
Caused by: org.sonar.api.utils.SonarException: No valid '.sln' file could be fou
nd. Please read the previous log messages to know more.
at org.sonar.plugins.csharp.core.VisualStudioProjectBuilder.createVisual
StudioSolution(VisualStudioProjectBuilder.java:169)
at org.sonar.plugins.csharp.core.VisualStudioProjectBuilder.build(Visual
StudioProjectBuilder.java:82)
at org.sonar.api.batch.bootstrap.ProjectBuilder.start(ProjectBuilder.jav
a:47)
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.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(
ReflectionLifecycleStrategy.java:110)
... 23 more
Sonar-Project.Properties;
# Project identification
sonar.projectKey=DMG:WindowsFormsApplication2
sonar.projectVersion=1.0-SNAPSHOT
sonar.projectName=my c #
sonar.projectVersion=1.0
# Info required for Sonar
sources=.
sonar.language=cs
#Core C# Settings
sonar.dotnet.visualstudio.solution.file=C:/Users/ea/Desktop/sonar-runner-2.0/sonar-runner- 2.0/bin/WindowsFormsApplication2.sln
#sonar.silverlight.4.mscorlib.location=C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/Silverlight/v4.0sonar.dotnet.excludeGeneratedCode=true
sonar.dotnet.4.0.sdk.directory=C:/WIndows/Microsoft.NET/Framework/v4.0.30319
sonar.dotnet.version=4.0
#Gendarme
sonar.gendarme.assemblies=\build\\DmgTech*.*
sonar.gendarme.mode=skip
# Gallio
sonar.gallio.mode=skip
# FXCop
sonar.fxcop.installDirectory=C:/Program Files/Microsoft FxCop 1.36
sonar.fxcop.assemblyDependencyDirectories=/bin/Debug
#StyleCop
sonar.stylecop.mode=skip
My folder;
WindowsFormsApplication2
WindowsFormsApplication2.sln
sonar-project.properties
sonar-runner.bat

The message is quite straightforward:
No valid '.sln' file could be found. Please read the previous log messages to know more.
This is because "sonar.dotnet.visualstudio.solution.file" property must point an SLN file, not to a folder like what you specified.
What's more, there are too many useless properties in your "sonar-project.properties" file:
No need to specify the following properties as you set it to their default values:
sonar.host.url
sonar.jdbc.username
sonar.jdbc.password
You specified "sonar.jdbc.username" and "sonar.jdbc.password" twice...

Related

Unable to run Sonar with Hybris

I am new to SonarQube and trying to run the analytics on all the extensions in one go. I am able to run it successfully for extensions individually but when I run "ant sonar" with hybris, it gives me below exception:
[echo] - sonar.jdbc.url : ${sonar.jdbc.url}
[echo] - sonar.projectName : Superproject
[echo] - sonar.project.key : superprojectkey
[echo] - sonar.project.version : 1.0
[echo] - sonar.excludedExtensions :
[echo] - sonar.language : java
[echo] *************************************************
[echo]
r:sonar] Apache Ant(TM) version 1.9.1 compiled on May 15 2013
r:sonar] Sonar Ant Task version: 2.1
r:sonar] Loaded from: file:/E:/hybris/bin/platform/resources/ant
r:sonar] INFO: Default locale: "en_IN", source code encoding: "UTF-8"
r:sonar] INFO: Work directory: E:\hybris\bin\platform\.sonar
r:sonar] ERROR: Sonar server 'http://localhost:9000' can not be reached
E:\\hybris\bin\platform\resources\ant\sonar.xml:84: org.sonar.runner.kevinsawicki.Ht
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:83)
at org.sonar.runner.impl.ServerVersion.downloadVersion(ServerVersion.java:49)
at org.sonar.runner.impl.ServerVersion.version(ServerVersion.java:40)
at org.sonar.runner.impl.ServerVersion.is35Compatible(ServerVersion.java:64)
at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:39)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:59)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:57)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:71)
at org.sonar.runner.api.Runner.execute(Runner.java:89)
at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:53)
at org.sonar.ant.SonarTask.execute(SonarTask.java:48)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.net.ConnectException: Connection refused: connect
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:1890)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1390)
... 44 more
I know this is an configuration issue but I could not locate the file where the LOG is saying it is.
Also, why is it requiring jdbc url?
Thanks.
i just write down the approach we are using within our projects - not exactly as we are wrapping ant with gradle but how we proceed and configure everything.
We are not using the ant sonar scanner but either, the gradle sonar scanner [1] or the jenkins sonar scanner [2], so in this case you could actually use the sonar scanner [3].
Configuring sonar properties:
you can easily put all your configurations in your project root in a file called sonar-project.properties.
sonar.host.url=<sonar url>
sonar.projectKey=<project key>
sonar.projectName=<project name>
# you could use here java as language, but if you also want to analyse JS and other languages remove it, and adapt the source path to add those too
sonar.language=java
sonar.sources=<path-to-extension>/src,\
<path-to-extension>/hmc/src,\
<path-to-extension>/web/src,\
sonar.tests=<path-to-extension>/testsrc
sonar.java.binaries=**/classes
sonar.java.libraries=**/*.jar
sonar.java.test.binaries=**/classes
sonar.java.test.libraries=**/*.jar
this is just a simple basic configuration - so you need to define your test plugin and paths in here too.
i added paths for web and hmc, if your extension is not using them remove them
i just added one extensions, you could simply extend it with multiple ones
every config you do, you can simply put into this sonar-project.properties, and you can even check it into your VCS, to share it with others.
benefits are that this settings are connected with your source, so if you have a new extension you also adapt the sonar settings, and do not need to adapt any build etc.
Running the scanner
now you can simple use every runner you like by using those project properties. either jenkins, or gradle or local, you just need to ensure that the sonar-project.properties file is in the root of your project, and pointing to the right files.
Acknowledge
i know this is not the default hybris way, and it is not using the ant target of hybris, but i figured out, that this approach gives me much more flexibility than the default way!
[1] https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle?src=contextnavpagetreemode
[2] https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins
[3] https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
are you sure that the Sonarqube server is launched? Maybe launch it manually and be sure that is is visible in your browser when accessing locallhost:9000/about .
As the root problem is the sonarserver not being available i'd go for that...
The Sonar Host URL is configured through a property called sonar.host.url
On the project I was working a while ago this property was set in hybris\config\local.properties
Related to the INFO: Work directory: E:\hybris\bin\platform.sonar logged,
I think that the working directory can be set using the sonar.working.directory which ,if not set, is somehow computed to be the one you saw in logs (i.e hybris\bin\platform.sonar)

Debugging Sonar Qube plugin

Following the guide at http://docs.sonarqube.org/display/DEV/Debugging, I have encounter an issue where the sonar-runner appears to be looking in the wrong place for the sonar-project.properties file.
This happens when I try to debug with Intellij.
Can anyone help?
Thanks
Matt
I get the following error:
SONAR_RUNNER_OPTS=-Xdebug -Xnoagent -Duser.dir=c:\dev\eci -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
INFO: Error stacktraces are turned on.
ERROR: homekey=runner.home
ERROR: homrelativePathFromHom=conf/sonar-runner.properties
ERROR: settingsKey=runner.settings
INFO: Runner configuration file: C:\Sonar\sonar-runner-2.4\conf\sonar- runner.properties
ERROR: homekey=project.home
ERROR: homrelativePathFromHom=sonar-project.properties
ERROR: settingsKey=project.settings
INFO: Project configuration file: NONE
INFO: Default locale: "en_AU", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: c:\dev\eci\.\.sonar
INFO: SonarQube Server 5.1.1
17:30:39.333 INFO - Load global repositories
17:30:39.340 DEBUG - Download: http://localhost:9000/batch/global (no proxy)
17:30:39.490 INFO - Load global repositories (done) | time=159ms
17:30:39.492 INFO - Server id: 20150731104939
17:30:39.493 INFO - User cache: C:\Users\matthewo\.sonar\cache
17:30:39.499 INFO - Install plugins
17:30:39.499 DEBUG - Download index of plugins
17:30:39.499 DEBUG - Download: http://localhost:9000/deploy/plugins/index.txt (no proxy)
17:30:39.585 DEBUG - Loaded 2138 properties from l10n bundles
17:30:39.585 INFO - Install JDBC driver
17:30:39.585 DEBUG - Download index of jdbc-driver
17:30:39.585 DEBUG - Download: http://localhost:9000/deploy/jdbc-driver.txt (no proxy)
17:30:39.592 INFO - Create JDBC datasource for jdbc:jtds:sqlserver://localhost:1433/Sonar;instance=MSSQL2012;SelectMethod=Curso r
17:31:03.765 DEBUG - Testing JDBC connection
17:31:04.351 DEBUG - Download: http://localhost:9000/api/server (no proxy)
17:31:04.368 INFO - Initializing Hibernate
17:31:04.370 DEBUG - hibernate.generate_statistics: false
17:31:04.370 DEBUG - hibernate.dialect: org.sonar.core.persistence.dialect.MsSql$MsSqlDialect
17:31:04.370 DEBUG - hibernate.connection.provider_class: org.sonar.jpa.session.CustomHibernateConnectionProvider
INFO: ---------------------------------------------------------------------- --
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 26.253s
Final Memory: 66M/340M
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: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
at org.sonar.batch.scan.ProjectReactorBuilder.checkMandatoryProperties(ProjectReact orBuilder.java:315)
at org.sonar.batch.scan.ProjectReactorBuilder.defineRootProject(ProjectReactorBuild er.java:157)
at org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
at org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:110)
at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:86)
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(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
Is there any way to set the working directory, so sonar-runner finds the project properties in the correct location - where I am executing the command from?
Thanks
Matt
Why are you trying to update the user directory? Try to remove -Duser.dir=c:\dev\eci from SONAR_RUNNER_OPTS

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-runner.bat Unable to execute Sonar at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher .java:91)

I got the latest sonar-runner-dist-2.4 and sonarqube-4.3. Server starts fine, i can see the localhost But when i try to run the sonar-runner.bat -X, i see the below error. I looked at versions, logs but couldn't find the root-cause. Any help will be appreciated.
enter code here
MyProject>sonar-runner.bat -X
C:\sonar\sonar-runner-dist-2.4
SonarQube Runner 2.4
Java 1.6.0 IBM Corporation (32-bit)
Windows Vista 6.1 build 7601 Service Pack 1 x86
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\sonar\sonar-runner-dist-2.4\conf\sonar-runne
r.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is
platform dependent)
INFO: Work directory: C:\cww\application\CWW_FSET_R0\online\aeEJB\.\.sonar
INFO: SonarQube Server 4.3
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1.191s
Final Memory: 2M/5M
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(AccessController.java:202
)
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.TypeNotPresentException: Type javax.annotation.CheckForNull
not present
at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.j
ava:38)
at com.ibm.oti.reflect.AnnotationHelper.getDeclaredAnnotations(Annotatio
nHelper.java:50)
at com.ibm.oti.reflect.Method.getDeclaredAnnotations(Method.java:31)
at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:687)
at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.ja
va:186)
at com.ibm.oti.reflect.Method.getAnnotation(Method.java:20)
at java.lang.reflect.Method.getAnnotation(Method.java:677)
at org.picocontainer.injectors.AdaptingInjection.injectionAnnotated(Adap
tingInjection.java:230)
at org.picocontainer.injectors.AdaptingInjection.access$000(AdaptingInje
ction.java:46)
at org.picocontainer.injectors.AdaptingInjection$1.run(AdaptingInjection
.java:203)
at java.security.AccessController.doPrivileged(AccessController.java:202
)
at org.picocontainer.injectors.AdaptingInjection.injectionMethodAnnotate
d(AdaptingInjection.java:200)
at org.picocontainer.injectors.AdaptingInjection.methodAnnotatedInjectio
nAdapter(AdaptingInjection.java:171)
at org.picocontainer.injectors.AdaptingInjection.createComponentAdapter(
AdaptingInjection.java:70)
at org.picocontainer.behaviors.AbstractBehaviorFactory.createComponentAd
apter(AbstractBehaviorFactory.java:44)
at org.picocontainer.behaviors.OptInCaching.createComponentAdapter(OptIn
Caching.java:45)
at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContai
ner.java:535)
at org.picocontainer.DefaultPicoContainer.access$300(DefaultPicoContaine
r.java:83)
at org.picocontainer.DefaultPicoContainer$AsPropertiesPicoContainer.addC
omponent(DefaultPicoContainer.java:1148)
at org.sonar.api.platform.ComponentContainer.addComponent(ComponentConta
iner.java:175)
at org.sonar.api.platform.ComponentContainer.addSingleton(ComponentConta
iner.java:163)
at org.sonar.api.platform.ComponentContainer.add(ComponentContainer.java
:149)
at org.sonar.batch.bootstrap.BootstrapContainer.addBootstrapComponents(B
ootstrapContainer.java:83)
at org.sonar.batch.bootstrap.BootstrapContainer.doBeforeStart(BootstrapC
ontainer.java:77)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:90)
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(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
.java:87)
... 9 more
Caused by: java.lang.ClassNotFoundException: javax.annotation.CheckForNull
at java.lang.Class.forName(Class.java:169)
at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.j
ava:33)
... 42 more
Here is my property file :
# required metadata
sonar.projectKey=my:MyProject
sonar.projectName=MyProject
sonar.projectVersion=1.0
# optional description
sonar.projectDescription=Any description
# path to source directories (required)
sonar.sources=src
# path to test source directories (optional)
#sonar.tests=testDir1,testDir2
# path to project binaries (optional), for example directory of Java bytecode
sonar.binaries=bin
# The value of the property must be the key of the language.
sonar.language=java
# Additional parameters
sonar.my.property=value
This issue seems to relate to the use of the IBM Java Virtual Machine : http://www-01.ibm.com/support/docview.wss?uid=swg1IZ76354. By using the Oracle one this should fix your issue.

Sonar and C#: Download of guava-10.0.1.jar fails due to timeout

we have Sonar set up to run on a separate server. It does, and a client application (sonar-runner) can connect successfully to it. However, the run interrupts with the following exception:
Runner configuration file: C:\Program Files (x86)\sonar-runner-1.3\bin\..\conf\sonar-runner.properties
Project configuration file: C:\project\subproject\sonar-project.properties
Runner version: 1.3
Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
OS name: "Windows 7", version: "6.1", arch: "x86"
Server: http://<serverip>:80
Work directory: C:\project\subproject\.sonar
Total time: 1:30.902s
Final Memory: 0M/15M
Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.sonar.batch.bootstrapper.BootstrapException: Fail to download the file: http://<serverip>:80/batch/guava-10.0.1.jar
at org.sonar.batch.bootstrapper.Bootstrapper.downloadBatchFiles(Bootstrapper.java:164)
at org.sonar.batch.bootstrapper.Bootstrapper.createClassLoader(Bootstrapper.java:87)
at org.sonar.runner.Runner.createClassLoader(Runner.java:155)
at org.sonar.runner.Runner.execute(Runner.java:78)
at org.sonar.runner.Main.main(Main.java:61)
Caused by: org.sonar.batch.bootstrapper.BootstrapException: Fail to download the file: http://<serverip>:80/batch/guava-10.0.1.jar
at org.sonar.batch.bootstrapper.Bootstrapper.remoteContentToFile(Bootstrapper.java:113)
at org.sonar.batch.bootstrapper.Bootstrapper.downloadBatchFiles(Bootstrapper.java:159)
... 4 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.ChunkedInputStream.readAheadBlocking(Unknown Source)
at sun.net.www.http.ChunkedInputStream.readAhead(Unknown Source)
at sun.net.www.http.ChunkedInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
at org.sonar.batch.bootstrapper.BootstrapperIOUtils.copyLarge(BootstrapperIOUtils.java:63)
at org.sonar.batch.bootstrapper.Bootstrapper.remoteContentToFile(Bootstrapper.java:109)
... 5 more
I can reproduce this with a normal browser. Retrieving the file opens the download manager, however, it takes up to 5 minutes until the file finally downloads (it's only 1.5 megs). Other files that are retrieved by the sonar-runner or using a browser do not have this problem.
The sonar logging doesn't seem to know that there is a problem. Downloads are not logged in the sonar.log file, neither successful ones nor the unsuccessful one. syslog doesn't contain any hints to problems.
had similar problem with sonar+php plugin and eset smart security. Had to disable filtering on 127.0.0.1 in filtering protocols section. It was happening randomly on different jars. It was happening on both solar ant task and solar runner
So, the solution was not something on the server, but rather a client-side problem. Kaspersky Endpoint Security seems to have a bug/feature that it needs to scan everything going over the network, and somehow this one JAR file triggered a multiple-minute-long delay while the file was being scanned.

Resources