7
votes

I have an instance of sonar running on my local machine at localhost:9000, and I'm able to go to and use the console. When I try to run sonar-runner from the command line for a project, I get a 500 error:

Exception in thread "main" org.sonar.runner.RunnerException: org.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public void org.sonar.batch.bootstrap.DatabaseCompatibility.start()', instance 'org.sonar.batch.bootstrap.DatabaseCompatibility@3848110b, org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [http://localhost:9000/api/server]. Response code: 500
    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: method 'public void org.sonar.batch.bootstrap.DatabaseCompatibility.start()', instance 'org.sonar.batch.bootstrap.DatabaseCompatibility@3848110b, org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [http://localhost:9000/api/server]. Response code: 500
    at org.picocontainer.monitors.NullComponentMonitor.lifecycleInvocationFailed(NullComponentMonitor.java:77)
...
...

But when i visit the url in my browser, I get the following xml response:

<server>
<id>20131007131041</id>
<version>3.4.1</version>
<status>UP</status>
</server>

I'm not sure where to go from here. Any advice?

2
Do you confirm that your database settings are the same in SONARQUBE_HOME/conf/sonar.properties and SONARQUBE_RUNNER_HOME/conf/sonar-runner.properties ?David RACODON - QA Consultant

2 Answers

4
votes

The current workaround is to unset GEM_PATH and GEM_HOME variables before launching the sonar webservice:

unset GEM_PATH GEM_HOME
./sonar.sh console

This doesn't have to be done for the sonar-runner environment.

The problem is caused due to conflict with Ruby local installation.

1
votes

As per the sonar-runner documentation you need to create a sonar-project.properties in your project root and then run sonar-runner from command line

ref Sonar runner docs

In my case it worked with following workaround

1: export GEM_HOME=''

2: export GEM_PATH=''

3: restart sonar webserver

4: run sonar-runner in project path