SonarQube扫描仪无法连接到服务器

时间:2017-12-04 11:23:23

标签: sonarqube

我遇到了无法连接SonarQube服务器的sonar-scanner-cli的问题。扫描从docker容器中运行。 Docker通过代理连接到SonarQube服务器,所以我认为这是问题,但我尝试设置代理环境变量,并将代理参数传递给扫描程序。这没有任何帮助。此外,yum或gradle等其他二进制文件也可以连接到外部存储库而不会出现问题。

SonarQube服务器版本:6.7.0.33306。

13:12:28.858 INFO: Scanner configuration file: /home/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQube_2.8/sonar-scanner-2.8/conf/sonar-scanner.properties 
13:12:28.869 INFO: Project root configuration file: NONE 
13:12:28.937 INFO: SonarQube Scanner 2.8 
13:12:28.937 INFO: Java 1.8.0_151 Oracle Corporation (64-bit) 
13:12:28.937 INFO: Linux
3.10.0-693.2.2.el7.x86_64 amd64 
13:12:29.854 DEBUG: keyStore is :  
13:12:29.854 DEBUG: keyStore type is : jks 
13:12:29.854 DEBUG: keyStore provider is :  
13:12:29.854 DEBUG: init keystore 
13:12:29.854 DEBUG: init keymanager of type SunX509 
13:12:30.067 DEBUG: Create : /home/jenkins/.sonar/cache 
13:12:30.074 INFO: User cache: /home/jenkins/.sonar/cache 
13:12:30.074 DEBUG: Create : /home/jenkins/.sonar/cache/_tmp 
13:12:30.075 DEBUG: Extract sonar-scanner-api-batch in temp... 
13:12:30.088 DEBUG: Get bootstrap index... 
13:12:30.089 DEBUG: Download: https://hostname/batch_bootstrap/index 
13:12:30.133 ERROR: SonarQube server [https://hostname] can not be reached 
13:12:30.133 INFO:
------------------------------------------------------------------------ 
13:12:30.133 INFO: EXECUTION FAILURE 
13:12:30.134 INFO:
------------------------------------------------------------------------ 
13:12:30.134 INFO: Total time: 1.342s 
13:12:30.153 INFO: Final Memory: 4M/148M 
13:12:30.154 INFO:
------------------------------------------------------------------------ 
13:12:30.154 ERROR: Error during SonarQube Scanner execution org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
    at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
    at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:72)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61) Caused by: java.lang.IllegalStateException: Fail to download libraries from server
    at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:93)
    at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
    at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)  ... 8 more Caused by: java.net.ConnectException: Failed to connect to hostname/IP:443
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:187)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.io.RealConnection.buildConnection(RealConnection.java:170)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.io.RealConnection.connect(RealConnection.java:111)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:187)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:123)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:93)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:296)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponse(RealCall.java:243)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:201)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.execute(RealCall.java:57)
    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.Jars.downloadFiles(Jars.java:78)
        ... 11 more

1 个答案:

答案 0 :(得分:0)

我认为您应该验证您的防火墙。在大多数系统中,端口9000未打开,它是常见的故障源。