SonarLint "Connection refused" to SonarQube 6.7

1.6k views Asked by At

Since upgrading SonarQube from 6.6 to 6.7 I'm facing the Problem, that I can't connect SonarLint for IntelliJ with the SonarQube Server.

I need to configure a corporate proxy but the configuration worked with SonarQube 6.6 and hitting "Test Connection" also returns an OK.

The Error Message when configuring the Server is:

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

Browsing the mentioned Page returns a valid Json Object:

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

The Error Log shows:

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

The SSL Certificate is self signed but added to the JVM so IntelliJ is aware of it (and there is no SSLHandshakeException)

I'm using:

  • IntelliJ IDEA 2017.3.2 (Ultimate Edition)
  • SonarQube 6.7
  • SonarLint 3.1.0.2244

Has anyone else the same problem? Any Ideas? Any Information missing?

Thanks in Advance

2

There are 2 answers

0
Christoph Forster On BEST ANSWER

I updated to SonarQube 6.7.1 a few days ago - this did not solve the problem.

Today I upgraded to IntelliJ IDEA 2017.3.3 - This fixed the problem

I don't know what exactly caused the problem but it's solved.

0
danka On

SonarQube refuses requests if the load is high.

SonarQube has some configuration in the sonar.properties. You can refine there the maxThreads:

It depends on your usage, the default values are very small, we use this:

sonar.web.http.maxThreads=500

sonar.web.http.minThreads=100

sonar.web.http.acceptCount=500

where the load is coming?

  • Jenkins build jobs for example via maven plugin
  • IDE plugins for Visual Studio, Eclipse or ItelliJ connect to Sonar for profiles
  • BitBucket searching for branch analyze report

I would also recommand to update the Java options:

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

SonarQube system admin page helps you to refine the values, because you see there the current usage.

/admin/system

Note: restart SonarQube service instead of using the restart button on admin page. Otherwise the new settings will be not used.