4
votes

I have recently setup Sonarqube-4.5.1 on my linux machine ( x86_64 x86_64 x86_64 GNU/Linux ).
I am able to start sonar with ./sonar.sh start command. On checking the sonar status with ./sonar.sh status command, it says SonarQube is running (18493) but when i try to open the dashboard url http://ip-address:9000 it shows "Connection refused" message on the browser.

On running the mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 command i get the following error:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project app-dao: Execution default-cli of goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar failed: SonarQube server can not be reached at http://localhost:9000. Please check the parameter 'sonar.host.url'. Connection refused -> [Help 1]

I also tried the solution mentioned at maven connecting to Sonar and added the following entries in my maven's conf/settings.xml file, but still unable to fix the issue.

<profile>
  <id>sonar</id>
  <activation>
   <activeByDefault>true</activeByDefault>
  </activation>
  <properties>
    <!-- EXAMPLE FOR MYSQL -->          
    <sonar.jdbc.username>admin</sonar.jdbc.username>
    <sonar.jdbc.password>admin</sonar.jdbc.password>            
    <sonar.host.url>http://localhost:9000</sonar.host.url>
  </properties>
</profile>
3
It is not clear whether Sonar is running on another machine than the one you browse/maven from? Which IP does Sonar bind to?Anders R. Bystrup
Sonar and Maven, both are setup on the same machine. "Which IP does Sonar bind to?" how should i check this. It would be localhost as i have not updated any default properties.Ash Ash
Run this in a shell to verify SonarQube is listening on port 9000: $ netstat -an | grep 9000MarkHu

3 Answers

2
votes

You have to start the Sonar Server first.

Go to \sonar-3.5.1\bin\windows-x86-32 and double click on StartSonar.bat

0
votes

Just ran into this issue this morning. Resolved it by configuring the server to access the MySQL database: http://docs.codehaus.org/display/SONAR/Installing

You want to edit the {sonar_home}/conf/sonar.properties and uncomment the url, username, and password.

You might have to add a new database user if you would like.

0
votes

In conf folder in installation directory sonar.properties file has a property sobar.web.host. If you have explicitly defined a ip this could cause this issue. Comment out and restart the server. This worked for me.