无法从服务器获取引导索引-读取超时-SonarQube Scanner

时间:2018-10-13 08:07:02

标签: sonarqube sonarqube-scan sonar-runner

我使用SonarQube验证并确保Ionic 3移动应用程序的代码质量。我使用MAC进行开发,并使用MAC中的SonarQube本地实例。

我使用的SonarQube的版本是7.3,而SonarQube Scanner的版本是3.2。根据文档,我运行了sonar.sh并看到SonarQube服务器已成功启动。我可以导航到http://localhost:9000/about来查看SonarQube页面。

在项目根文件夹中创建了一个名为sonar-project的文件,并在其中提供了以下信息。

# must be unique in a given SonarQube instance
sonar.projectKey= com.domain.app
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName= 'myApp'
sonar.projectVersion= '0.0.1'

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set. 
sonar.sources= './'

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

还编辑了/Users/ustuser/Documents/Softwares/sonar-scanner-3.2.0.1227-macosx/conf/sonar-scanner.properties文件,使其具有以下属性。

#----- Default SonarQube server
sonar.host.url=http://localhost:9000

#----- Default source code encoding
sonar.sourceEncoding=UTF-8

sonar.java.source=1.8


# Language
sonar.language=ts

导航到http://localhost:9000/并登录广告管理员。通过提供我的项目唯一密钥来生成通过密钥。使用所有信息,创建了一个.command文件。下面是详细信息

sonar-scanner \
  -Dsonar.projectKey=com.domain.app \
  -Dsonar.sources=.\
  -Dsonar.host.url=http://localhost:9000 \
  -Dsonar.login=xxxx69c0bc10ba1b78xxxx2c2c1d305c7cfxxxx

从项目根目录运行命令文件时,出现以下错误。

INFO: SonarQube Scanner 3.2.0.1227
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Mac OS X 10.13.6 x86_64
INFO: User cache: /Users/ustuser/.sonar/cache
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:00.388s
INFO: Final Memory: 4M/123M
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: timeout
ERROR: Caused by: Read timed out
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging

我只能在互联网上使用独立的SonarQube扫描仪找到有限的信息。

在使用-X开关运行时,出现以下错误。

                                                                                                         10:29:30.729 DEBUG: Extract sonar-scanner-api-batch in temp...
10:29:30.743 DEBUG: Get bootstrap index...
10:29:30.743 DEBUG: Download: http://localhost:9000/batch/index
10:30:30.872 INFO: ------------------------------------------------------------------------
10:30:30.872 INFO: EXECUTION FAILURE
10:30:30.872 INFO: ------------------------------------------------------------------------
10:30:30.873 INFO: Total time: 1:00.621s
10:30:30.905 INFO: Final Memory: 4M/123M
10:30:30.905 INFO: ------------------------------------------------------------------------
10:30:30.905 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.SocketTimeoutException: timeout
    at org.sonarsource.scanner.api.internal.shaded.okio.Okio$4.newTimeoutException(Okio.java:230)
    at org.sonarsource.scanner.api.internal.shaded.okio.AsyncTimeout.exit(AsyncTimeout.java:285)
    at org.sonarsource.scanner.api.internal.shaded.okio.AsyncTimeout$2.read(AsyncTimeout.java:241)
    at org.sonarsource.scanner.api.internal.shaded.okio.RealBufferedSource.read(RealBufferedSource.java:46)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http1.Http1Codec$UnknownLengthSource.read(Http1Codec.java:482)
    at org.sonarsource.scanner.api.internal.shaded.okio.RealBufferedSource.request(RealBufferedSource.java:67)
    at org.sonarsource.scanner.api.internal.shaded.okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:408)
    at org.sonarsource.scanner.api.internal.shaded.okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:392)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.Util.bomAwareCharset(Util.java:431)
    at org.sonarsource.scanner.api.internal.shaded.okhttp.ResponseBody.string(ResponseBody.java:174)
    at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99)
    at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)
    ... 10 more
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:171)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at org.sonarsource.scanner.api.internal.shaded.okio.Okio$2.read(Okio.java:139)
    at org.sonarsource.scanner.api.internal.shaded.okio.AsyncTimeout$2.read(AsyncTimeout.java:237)
    ... 19 more

0 个答案:

没有答案