Error during SonarScanner CLI execution + Ruby on Rails

I’m using SonarScanner CLI 6.1.0.4477 and already installed sonarqube. For static code analysis I’m using sonarqube.zip and not cloud. While executing command sonar-scanner -X I’m getting an error related to sonar-cloud java.lang.IllegalStateException: Error status returned by url [https://api.sonarcloud.io/analysis/jres?os=linux&arch=x86_64]: 401 although I havent used sonar-cloud.

Hi,

If you’re using SonarScanner CLI 6.x and don’t set the “sonar.host.url” property, it will default to SonarCloud. To specify a different SonarQube server, you can set this property in the sonar-scanner.properties file or directly during the analysis with a command like:

sonar-scanner -Dsonar.host.url=http://your-sonarqube-server

Have already tried setting the sonar.host.url property but it still gives an error.

Can you access http://127.0.0.1:3000 on a browser?

nope unable to acess it.

So, are you sure that the SonarQube server is running? What address do you use to open the web interface?

By default, SonarQube is accessible on port 9000 unless the sonar.web.port property in the conf/sonar.properties file has been modified.

yes its running. I am using command ./sonar.sh start and it gives me Started SonarQube.. And I am accessing it using the default port only.

What value are you using for sonar.host.url? It should be the same url you’re using to access the web interface.

I’m using the default one. sonar.host.url=http://localhost:9000. Accessing using rails s -p 9000 on web interface. Then running command sonar-scanner -X into my project path and getting error Caused by: java.lang.IllegalStateException: Error status returned by url [http://localhost:9000/api/v2/analysis/version]: 404

Why are you using the rails command?

Please follow the instructions from the documentation:

Execute the following script to start the server:

  • On Linux: <sonarqubeHome>/bin/linux-x86-64/sonar.sh start
  • On macOS: <sonarqubeHome>/bin/macosx-universal-64/sonar.sh start
  • On Windows: <sonarqubeHome>\bin\windows-x86-64\StartSonar.bat

You can now browse SonarQube at http://localhost:9000 (the default system administrator credentials are admin/admin).

Followed same steps. After executing the script to start the server On Linux: <sonarqubeHome>/bin/linux-x86-64/sonar.sh start it says Started SonarQube. But when browsing http://localhost:9000 gives error This site can’t be reached localhost refused to connect.

any thoughts on this?

Hey,
any updates on this?