'SonarQube server can not be reached at http://localhost:9000 with Sonarqube-4.5.1

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>


Solution 1:[1]

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.

Solution 2:[2]

You have to start the Sonar Server first.

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

Solution 3:[3]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 casey
Solution 2 Nidheesh
Solution 3 Anantha