[ERROR] 05:29:08.746 SonarQube server [http://localhost:9000] can not be reached

[ERROR] 05:29:08.746 SonarQube server [http://localhost:9000] can not be reached

    • I am using sonar 10.4.1 and plugin I am using Sonar scanner for jenkins.
    • I want to integrate sonar with jenkins.
    • My jenkins is installed in ubuntu server, and Sonar is running in windows, through cli, using StartSonar.bat command.
    • I am using jenkins with http://ubuntuJenkins_ip:8080 and sonar with http://windows_ip:9000.
    • Now When i am trying to run a pipeline in jenkins using following script:
      sh ā€œmvn clean packageā€
      sh ā€˜ā€™ā€™ mvn sonar:sonar -Dsonar.url=http://windows_ip:9000
      -Dsonar.login=Sonar_token
      -Dsonar.projectKey=SonarSAST
      -Dsonar.java.binaries=.
      -Dsonar.projectName=SonarSAST
      ā€˜ā€™ā€™
      I am getting error :

[INFO] 05:29:08.707 User cache: /var/lib/jenkins/.sonar/cache
[ERROR] 05:29:08.746 SonarQube server [http://localhost:9000] can not be reached
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

I have gone through many solution given online,

  • checked my fireawall,
  • checked my network
  • checked jenkins configuration
  • checked Sonarqube configuration
  • used http://windows_ip:9000
  • used http://localhost:9000
  • Set up webhook in Sonar http://ubuntuJenkins_ip:8080/sonarqube-webhook, etc, etc.

still I am not able to solve this issue,
earlier i have resolved this issue, but after i have reinstalled everything. I am stuck in this issue again. Please help on this issue…!!

Hi,

Welcome to the community!

Are SonarQube and Jenkins hosted on the same server?

http://localhost:9000 is the default SonarQube URL, so its user here indicates that sonar.host.url hasn’t been configured for the analysis.

 
HTH,
Ann

Hi, Thanks for replying,
Yes, sonarqube and jenkins are hosted in windows (edge browser).
jenkins is opened with ubuntu ip(where it is actually installed) &
Sonar is opened with wondows ip(where it is actually installed)

I used ā€œ-Dsonar.host.urlā€ insted of -Dsonar.url and also i did these steps in sonarqube settings:

  • Log in to the SonarQube dashboard and click on the ā€œAdministrationā€ tab.
  • Browse to the ā€œConfiguration → General settings → Generalā€ menu.
  • Under the ā€œGeneralā€ section, change the ā€œServer base URLā€ to the new server domain name.

It worked for me,

Thanks a lot.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.