Unable to run Sonar with Hybris - sonarqube

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)

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

Unable to start SonarQube after migration from 6.0 -> 6.7 LTS

I'm trying to upgrade my SonarQube instance from a SonarQube 6.0 installation to SonarQube 6.7.
When I start SonarQube, its failing with the following exception:
2017.11.21 05:22:43 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalArgumentException: There is already a quality profile with name 'Sonar way' for language 'java'
at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.sonar.api.server.profile.BuiltInQualityProfilesDefinition$Context.registerProfile(BuiltInQualityProfilesDefinition.java:78)
at org.sonar.api.server.profile.BuiltInQualityProfilesDefinition$Context.access$300(BuiltInQualityProfilesDefinition.java:62)
at org.sonar.api.server.profile.BuiltInQualityProfilesDefinition$NewBuiltInQualityProfileImpl.done(BuiltInQualityProfilesDefinition.java:170)
at org.sonar.server.qualityprofile.BuiltInQProfileDefinitionsBridge.define(BuiltInQProfileDefinitionsBridge.java:88)
at org.sonar.server.qualityprofile.BuiltInQProfileDefinitionsBridge.define(BuiltInQProfileDefinitionsBridge.java:67)
at org.sonar.server.qualityprofile.BuiltInQProfileRepositoryImpl.initialize(BuiltInQProfileRepositoryImpl.java:68)
at org.sonar.server.qualityprofile.BuiltInQProfileLoader.start(BuiltInQProfileLoader.java:37)
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.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:134)
at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
at org.sonar.server.platform.platformlevel.PlatformLevelStartup.access$001(PlatformLevelStartup.java:45)
at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:83)
at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:45)
at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:80)
at org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:196)
at org.sonar.server.platform.Platform.access$400(Platform.java:46)
at org.sonar.server.platform.Platform$1.lambda$doRun$1(Platform.java:121)
at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
at org.sonar.server.platform.Platform$1.doRun(Platform.java:121)
at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
at java.lang.Thread.run(Thread.java:745)
2017.11.21 05:22:43 INFO web[][o.s.p.StopWatcher] Stopping process
Is there a way to fix this problem?
I have not heavily edited the quality profile, so I'm comfortable with reverting that back to defaults.
As mentioned in the comments, it might be a problem of an outdated plugin. Here is what I did to solve the issue:
Remove the sonar-java plugin file from the extensions/plugins/ folder. (Also remove any plugins depending on java, if you see error messages for this in ce.log .)
If you are behind a proxy set up proxy settings for Marketplace in conf/sonar.properties . Note, that Marketplace does not claims for connection errors (at least in current version) just does not shows up available plugins. (But does log connection errors to web.log .)
Stop, and start SonarQube.
Login as Admin, and install the latest version of SonarJava plugin from Marketplace.

Sonar Eclipse plugin: Failed to download batch_bootstrap/db

I'm having issues with the Eclipse plugin of sonar. When executing it I'm getting the following exception in the Eclipse console:
Exception in thread "main" 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.impl.BatchLauncherMain.execute(BatchLauncherMain.java:41)
at org.sonar.runner.impl.BatchLauncherMain.main(BatchLauncherMain.java:59)
Caused by: org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [http://<server>/batch_bootstrap/db?project=<project>]. Response code: 500
at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:281)
at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:235)
at com.google.common.io.ByteStreams.copy(ByteStreams.java:116)
at com.google.common.io.Files.copy(Files.java:231)
at org.sonar.batch.bootstrap.ServerClient.download(ServerClient.java:69)
at org.sonar.batch.bootstrap.PreviewDatabase.downloadDatabase(PreviewDatabase.java:101)
at org.sonar.batch.bootstrap.PreviewDatabase.start(PreviewDatabase.java:69)
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)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91)
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:45)
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)
... 6 more
We're running SonarQube Server 4.1.2, the plugin version is 3.3.0.
Any ideas?
Update
Could this be related to poor DB performance (even though it's not some timeout exception)? Sonar runs on an Oracle DB, and we just updated sonar which resolved issues with excessively long query times (but weirdly enough only for logged in users). I added login information in the plugin settings though, so i assumed it should work.
When opening a source file in Eclipse, I'm getting messages like
Retrieve issues of resource ResultUtil.java...
Done in 43625ms
which sounds like the query would be running way longer that desirable.
Update 2:
We realized that even though the project existed in SonarQube, and was analyzed, it was not provisioned (the project was created with a pre 4.0 version of SonarQube). To rule out that caused the issue we provisioned a new project in SonarQube, ran the analysis on that and configured the eclipse plugin to use this new project.
This did not resolve the issue, either we're getting the same exception, or no further message at all. Calling the URL in a web-browser yields the same result (i.e. endlessly says "waiting for <server>".
The "SonarQube Web Browser" view of the eclipse plugin correctly shows issues, which I take as a sign that the plugin is configured correctly. Also, for some reason querying the issues from SonarQube is now a lot faster, so I would rule out that this caused the issue.
Any more suggestions on what we could check?
Update 3
We tried restarting SonarQube and then tried to analyze the project using the eclipse plugin. This failed with the above exception. Checking the SonarQube logs revealed these issues:
2014.03.19 11:17:35 ERROR [o.s.c.p.DbTemplate] Fail to copy table rules
org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "RULES_PLUGIN_KEY_AND_NAME ON PUBLIC.RULES(PLUGIN_RULE_KEY, PLUGIN_NAME)"; SQL statement:
INSERT INTO rules(ID,PLUGIN_RULE_KEY,PLUGIN_NAME,DESCRIPTION,PRIORITY,CARDINALITY,PARENT_ID,PLUGIN_CONFIG_KEY,NAME,STATUS,LANGUAGE,CREATED_AT,UPDATED_AT) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?) [23505-172]
at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1167) ~[h2-1.3.172.jar:1.3.172]
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) ~[commons-dbcp-1.4.jar:1.4]
at org.sonar.core.persistence.DbTemplate.copyTableColumns(DbTemplate.java:100) [sonar-core-4.1.2.jar:na]
at org.sonar.core.persistence.DbTemplate.copyTableColumns(DbTemplate.java:54) [sonar-core-4.1.2.jar:na]
at org.sonar.core.persistence.DbTemplate.copyTable(DbTemplate.java:49) [sonar-core-4.1.2.jar:na]
at org.sonar.core.persistence.PreviewDatabaseFactory.copy(PreviewDatabaseFactory.java:87) [sonar-core-4.1.2.jar:na]
at org.sonar.core.persistence.PreviewDatabaseFactory.createNewDatabaseForDryRun(PreviewDatabaseFactory.java:63) [sonar-core-4.1.2.jar:na]
at org.sonar.core.preview.PreviewCache.generateNewDB(PreviewCache.java:121) [sonar-core-4.1.2.jar:na]
at org.sonar.core.preview.PreviewCache.getDatabaseForPreview(PreviewCache.java:81) [sonar-core-4.1.2.jar:na]
at org.sonar.server.ui.JRubyFacade.createDatabaseForPreview(JRubyFacade.java:471) [JRubyFacade.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
(... snip ...)
followed by
2014.03.19 11:17:35 ERROR [o.s.s.ui.JRubyFacade] Fail to render: http://hulk:9000/batch_bootstrap/db?project=E2PR-12.0
attempt to unlock read lock, not locked by current thread
java.util.concurrent.locks.ReentrantReadWriteLock$Sync.unmatchedUnlockException(ReentrantReadWriteLock.java:447)
java.util.concurrent.locks.ReentrantReadWriteLock$Sync.tryReleaseShared(ReentrantReadWriteLock.java:431)
java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1340)
java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.unlock(ReentrantReadWriteLock.java:883)
org.sonar.core.preview.PreviewCache.getDatabaseForPreview(PreviewCache.java:92)
org.sonar.server.ui.JRubyFacade.createDatabaseForPreview(JRubyFacade.java:471)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
(... snip ...)
Subsequent analysis runs triggered by the eclipse plugin seem to hang at 11:28:46.317 DEBUG - Download: http://hulk:9000/batch_bootstrap/db?project=E2PR-12.0 (no proxy)
I can provide the logfile if that would help you to find out what's wrong.
It looks like your project has not been analyzed in SonarQube prior to running preview analyses in Eclipse. See http://docs.codehaus.org/display/SONAR/Configuring+SonarQube+in+Eclipse.
So, after a lot of digging I was able to resolve this issue. What pointed into the right direction was this discussion: http://comments.gmane.org/gmane.comp.java.sonar.general/33747
In the end this was caused by duplicate manual rules in the RULES table. I have no idea how they ended up there, but they were not visible from the UI, which made it kinda hard to spot.
After deleting these rules in the DB I'm now able to trigger the analysis from eclipse.

Sonar-Runner not starting (c#)

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...

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