SonarScanner service error

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): SonarQube 7.3 and scanner:sonar-scanner-3.2.0.1227, Plugin: C#4.5 and integrated with vsts
  • what are you trying to achieve: I ma unable to connect sonarqube server host url: localhost:9000
  • what have you tried so far to achieve this: whenever try to runthe sonarscannerservice -X on commadn prompt getting below error:

E:\sonar-scanner-msbuild-4.4.2.1543-net46\sonar-scanner-3.2.0.1227\bin>sonar-scanner.bat
INFO: Scanner configuration file: E:\sonar-scanner-msbuild-4.4.2.1543-net46\sonar-scanner-3.2.0.1227\bin…\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.2.0.1227
INFO: Java 1.8.0_181 Oracle Corporation (64-bit)
INFO: Windows Server 2016 10.0 amd64
INFO: User cache: C:\Users\RKatrenikona.sonar\cache
ERROR: SonarQube server [http://localhost:9000] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.994s
INFO: Final Memory: 4M/234M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to execute SonarQube
ERROR: Caused by: Fail to get bootstrap index from server
ERROR: Caused by: Failed to connect to localhost/0:0:0:0:0:0:0:1:9000
ERROR: Caused by: Connection refused: connect
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

E:\sonar-scanner-msbuild-4.4.2.1543-net46\sonar-scanner-3.2.0.1227\bin>sonar-scanner.bat -X
08:56:40.393 INFO: Scanner configuration file: E:\sonar-scanner-msbuild-4.4.2.1543-net46\sonar-scanner-3.2.0.1227\bin…\conf\sonar-scanner.properties
08:56:40.400 INFO: Project root configuration file: NONE
08:56:40.444 INFO: SonarQube Scanner 3.2.0.1227
08:56:40.449 INFO: Java 1.8.0_181 Oracle Corporation (64-bit)
08:56:40.449 INFO: Windows Server 2016 10.0 amd64
08:56:40.827 DEBUG: keyStore is :
08:56:40.830 DEBUG: keyStore type is : jks
08:56:40.831 DEBUG: keyStore provider is :
08:56:40.832 DEBUG: init keystore
08:56:40.834 DEBUG: init keymanager of type SunX509
08:56:41.265 DEBUG: Create: C:\Users\RKatrenikona.sonar\cache
08:56:41.268 INFO: User cache: C:\Users\RKatrenikona.sonar\cache
08:56:41.269 DEBUG: Create: C:\Users\RKatrenikona.sonar\cache_tmp
08:56:41.276 DEBUG: Extract sonar-scanner-api-batch in temp…
08:56:41.297 DEBUG: Get bootstrap index…
08:56:41.299 DEBUG: Download: http://localhost:9000/batch/index
08:56:43.401 ERROR: SonarQube server [http://localhost:9000] can not be reached
08:56:43.403 INFO: ------------------------------------------------------------------------
08:56:43.405 INFO: EXECUTION FAILURE
08:56:43.406 INFO: ------------------------------------------------------------------------
08:56:43.407 INFO: Total time: 3.052s
08:56:43.455 INFO: Final Memory: 5M/234M
08:56:43.456 INFO: ------------------------------------------------------------------------
08:56:43.458 ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:167)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:113)
at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)
at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
… 7 more
Caused by: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:9000
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:225)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connect(RealConnection.java:149)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:195)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.execute(RealCall.java:69)
at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:113)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:98)
at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)
… 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.connectSocket(Platform.java:124)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:223)
… 30 more

E:\sonar-scanner-msbuild-4.4.2.1543-net46\sonar-scanner-3.2.0.1227\bin>

E:\sonar-scanner-msbuild-4.4.2.1543-net46\sonar-scanner-3.2.0.1227\bin>

Could you help me on this

Hi.

Do you have a SonarQube server located at localhost:9000?

Colin

Yes Colin, i located below ip address: 10.143.5.7

colin,
As per your instructions, i have modified the “sonar-scanner.bat -Dsonar.host.url=http://10.143.5.7” parameter
in my sonarscanner conf file

but getting error
09:25:04.754 DEBUG: keyStore type is : jks
09:25:04.754 DEBUG: keyStore provider is :
09:25:04.754 DEBUG: init keystore
09:25:04.755 DEBUG: init keymanager of type SunX509
09:25:05.097 DEBUG: Create: C:\Users\RKatrenikona.sonar\cache
09:25:05.120 INFO: User cache: C:\Users\RKatrenikona.sonar\cache
09:25:05.121 DEBUG: Create: C:\Users\RKatrenikona.sonar\cache_tmp
09:25:05.125 DEBUG: Extract sonar-scanner-api-batch in temp…
09:25:05.152 DEBUG: Get bootstrap index…
09:25:05.154 DEBUG: Download: http://localhost:9000/batch/index
09:25:07.234 ERROR: SonarQube server [http://localhost:9000] can not be reached
09:25:07.235 INFO: ------------------------------------------------------------------------
09:25:07.235 INFO: EXECUTION FAILURE
09:25:07.235 INFO: ------------------------------------------------------------------------
09:25:07.235 INFO: Total time: 2.899s
09:25:07.282 INFO: Final Memory: 4M/234M
09:25:07.292 INFO: ------------------------------------------------------------------------
09:25:07.293 ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:167)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:113)
at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)
at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
… 7 more
Caused by: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:9000
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:225)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connect(RealConnection.java:149)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:195)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.execute(RealCall.java:69)
at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:113)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:98)
at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)
… 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.connectSocket(Platform.java:124)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:223)
… 30 more

E:\sonar-scanner-msbuild-4.4.2.1543-net46\sonar-scanner-3.2.0.1227\bin>

Taking a step back – let me reccomend that you use the SonarQube Scanner directly, rather than the scanner embedded in the SonarQube Scanner for MSBuild. Unless you are trying to scan a C# solution, in which case you should use the latter (and follow the documentation to do so).

As per your instructions, i have modified the “sonar-scanner.bat -Dsonar.host.url=http://10.143.5.7” parameter in my sonarscanner conf file

Can you clarify the location of this file and its exact contents?

Colin

I have extracted e:\ drive location and installed on machine ip was 10.143.5.7

in both sonar scanner and sonarqube
sonarqube-7.3 - Sonarqube verision
sonar-scanner-msbuild-4.4.2.1543-net46 - sonar scanner

I got the same kind of error on my Linux system:

/opt/sonar-scanner-3.3.0.1492-linux/bin/sonar-scanner
INFO: Scanner configuration file: /opt/sonar-scanner-3.3.0.1492-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/WIFIOnOff/sonar-project.properties
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Linux 4.19.12-arch1-1-ARCH amd64
INFO: User cache: /home/user/.sonar/cache
ERROR: SonarQube server [http://localhost:9000] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.246s
INFO: Final Memory: 4M/119M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to execute SonarQube
ERROR: Caused by: Fail to get bootstrap index from server
ERROR: Caused by: Failed to connect to localhost/0:0:0:0:0:0:0:1:9000
ERROR: Caused by: Verbindungsaufbau abgelehnt (Connection refused)
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Hey Ravi,

Did you find any solution for this. Even i am on the same page. If yes, can you please share.

it is admin privileges error