2

自从将 SonarQube 从 6.6 升级到 6.7 后,我遇到了一个问题,即我无法将用于 IntelliJ 的 SonarLint 与 SonarQube 服务器连接起来。

我需要配置一个公司代理,但该配置适用于 SonarQube 6.6 并且点击“测试连接”也返回一个 OK。

配置服务器时的错误消息是:

Failed to connect to the server. Please check the configuration. Error: Fail to request https://mysonardomain/sonar/api/system/status

浏览提到的页面会返回一个有效的 Json 对象:

{
    "id": "xxxxxxxxxxxxxxx",
    "version": "6.7.0.33306",
    "status": "UP"
}

错误日志显示:

Connection test failed
java.lang.IllegalStateException: Fail to request https://mysonardomain.com/sonar/api/system/status 
    at org.sonarsource.sonarlint.core.util.ws.HttpConnector.doCall(HttpConnector.java:179)
    at org.sonarsource.sonarlint.core.util.ws.HttpConnector.get(HttpConnector.java:111)
    at org.sonarsource.sonarlint.core.util.ws.HttpConnector.call(HttpConnector.java:100)
    at org.sonarsource.sonarlint.core.container.connected.SonarLintWsClient.rawGet(SonarLintWsClient.java:114)
    at org.sonarsource.sonarlint.core.container.connected.validate.ServerVersionAndStatusChecker.fetchServerInfos(ServerVersionAndStatusChecker.java:97)
    at org.sonarsource.sonarlint.core.container.connected.validate.ServerVersionAndStatusChecker.checkVersionAndStatus(ServerVersionAndStatusChecker.java:61)
    at org.sonarsource.sonarlint.core.container.connected.validate.ServerVersionAndStatusChecker.checkVersionAndStatus(ServerVersionAndStatusChecker.java:51)
    at org.sonarsource.sonarlint.core.WsHelperImpl.validateConnection(WsHelperImpl.java:60)
    at org.sonarsource.sonarlint.core.WsHelperImpl.validateConnection(WsHelperImpl.java:53)
    at org.sonarlint.intellij.tasks.ConnectionTestTask.run(ConnectionTestTask.java:53)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:713)
    at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:397)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:157)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:543)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
    at com.intellij.openapi.application.impl.ApplicationImpl.a(ApplicationImpl.java:575)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:315)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Failed to connect to mysonardomain.com/10.1.1.10:443
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:223)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:147)
    at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:192)
    at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
    at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
    at okhttp3.RealCall.execute(RealCall.java:69)
    at org.sonarsource.sonarlint.core.util.ws.HttpConnector.doCall(HttpConnector.java:176)
... 23 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at okhttp3.internal.platform.Platform.connectSocket(Platform.java:124)
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:221)
... 41 more

SSL 证书是自签名的,但已添加到 JVM,因此 IntelliJ 知道它(并且没有 SSLHandshakeException)

我正在使用:

  • IntelliJ IDEA 2017.3.2(终极版)
  • SonarQube 6.7
  • SonarLint 3.1.0.2244

还有其他人有同样的问题吗?有任何想法吗?缺少任何信息吗?

提前致谢

4

2 回答 2

0

几天前我更新到 SonarQube 6.7.1 - 这并没有解决问题。

今天我升级到 IntelliJ IDEA 2017.3.3 - 这解决了问题

我不知道究竟是什么导致了这个问题,但它已经解决了。

于 2018-01-23T14:53:56.897 回答
0

如果负载很高,SonarQube 会拒绝请求。

SonarQube 在sonar.properties中有一些配置。您可以在那里细化maxThreads

这取决于你的使用情况,默认值很小,我们使用这个:

sonar.web.http.maxThreads=500

sonar.web.http.minThreads=100

sonar.web.http.acceptCount=500

负载在哪里?

  • Jenkins 例如通过 maven 插件构建工作
  • 用于 Visual Studio、Eclipse 或 ItelliJ 的 IDE 插件连接到 Sonar 以获取配置文件
  • BitBucket 搜索分支分析报告

我还建议更新 Java 选项:

sonar.web.javaOpts=-Xmx2024m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -server

SonarQube 系统管理页面可帮助您细化这些值,因为您可以在那里看到当前的使用情况。

/管理员/系统

注意:重新启动 SonarQube 服务,而不是使用管理页面上的重新启动按钮。否则将不会使用新设置。

于 2020-02-13T10:40:47.127 回答