SonarQube Server Authentication failing (on SSL-connection)

Hi,

I just installed the new Eclipse Photon along with SonarLint (3.6.0.201806071228) and opened my existing workspace. Now SonarQube Server Authentication is suddenly failing.

Exception Stack Trace

java.lang.IllegalStateException: Fail to request https://sonar:9443/api/system/status
	at org.sonarsource.sonarlint.core.util.ws.HttpConnector.doCall(HttpConnector.java:195)
	at org.sonarsource.sonarlint.core.util.ws.HttpConnector.get(HttpConnector.java:121)
	at org.sonarsource.sonarlint.core.util.ws.HttpConnector.call(HttpConnector.java:108)
	at org.sonarsource.sonarlint.core.container.connected.SonarLintWsClient.rawGet(SonarLintWsClient.java:115)
	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.container.connected.update.perform.GlobalStorageUpdateExecutor.update(GlobalStorageUpdateExecutor.java:77)
	at org.sonarsource.sonarlint.core.container.connected.ConnectedContainer.update(ConnectedContainer.java:109)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$null$1(ConnectedSonarLintEngineImpl.java:174)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.runInConnectedContainer(ConnectedSonarLintEngineImpl.java:306)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$update$2(ConnectedSonarLintEngineImpl.java:174)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withRwLock(ConnectedSonarLintEngineImpl.java:320)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.update(ConnectedSonarLintEngineImpl.java:169)
	at org.sonarlint.eclipse.core.internal.server.Server.updateStorage(Server.java:291)
	at org.sonarlint.eclipse.core.internal.jobs.ServerUpdateJob.run(ServerUpdateJob.java:51)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
Caused by: java.net.ConnectException: Failed to connect to sonar/xx.x.xxx.xx:9443
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:242)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
	at okhttp3.RealCall.execute(RealCall.java:77)
	at org.sonarsource.sonarlint.core.util.ws.HttpConnector.doCall(HttpConnector.java:193)
	... 16 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.base/java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.base/java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:400)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:243)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:225)
	at java.base/java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:402)
	at java.base/java.net.Socket.connect(Socket.java:591)
	at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129)
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:240)
	... 34 more

Session Data:

    eclipse.buildId=4.8.0.I20180611-0500
    java.version=10.0.1
    java.vendor=Oracle Corporation
    BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
    Framework arguments:  -product org.eclipse.epp.package.jee.product
    Command-line arguments:  -data file:/C:/dev/xxx/ -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

I can access the https://sonar:9443/api/system/status page via browser. Anybody else experiencing this?

Regards
Jonny

1 Like

Is your SSL certificate trused and valid (not expired, hostname equal to sonar etc)?

I know that the stacktrace is different from those topics, but maybe the cause is the same:

2 Likes

Thanks a million, this was a useful hint. I forgot to add the certs on Eclipse startup. In my case, startup Eclipse
eclipse.exe -vmargs -Djavax.net.ssl.trustStore=c:/dev/eclipse/eclipse-cacerts-mycompany.jks
did the trick.

A more intuitive stacktrace would have been handy here.

1 Like

I am having the same issue. SonarLint cannot connect to SonarQube because “Fail to request …/api/system/status”

First of all, where do I see the logs for this?

Secondly, I imported the certificate into keystore and included that in the eclipse. Still having the same issue. Please help

In Eclipse you can find logs on Console tab:

1 Like

Problem is nothing is getting logged in the console. As you can see from my screen grab, the error is there while connecting to SonarQube but there is no log. I have imported the certifcates in a new keystore and using that keystore in eclipse.ini. Can’t figure out where is the problem

Can you also look at Eclipse “Error log” view? Sometimes the stacktrace go there.

there is no error log related to this issue in any console/view

In the Sonarlint console, can you ensure verbose output is enabled?
image

1 Like

Thanks for the tip. It worked. I can now see the error log.

The hostname and the CN are same. I can access the sonarqube using web browser. Don’t know what is the issue here.

at org.sonarlint.eclipse.ui.internal.server.wizard.ServerConnectionTestJob.run(ServerConnectionTestJob.java:53)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: javax.net.ssl.SSLPeerUnverifiedException: Hostname xxx.westus.cloudapp.azure.com not verified:
    certificate: sha256/ZebSo6xrjudjbMOhij1+LEakeCng4dRYRoymu4fh1mE=
    DN: EMAILADDRESS=Infra.Services.SCM.Admin@yyy.com, CN=xxx.westus.cloudapp.azure.com, OU=IT, O=All Companies Inc, L=San Fransisco, ST=California, C=US
    subjectAltNames: []
	at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:316)
	at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:270)

Can you share the full stacktrace please ? Also make sure to use ``` markers to format your post, and increase readability.

If the stacktrace differs from initial one in this topic then we will forks this in a separate topic, to keep both discussions focused and on topic.

1 Like

Hi,
we have the same probleme, we using the 4.0.2 plugin in Intellij.

See below:

java.lang.IllegalStateException: Fail to request https://sonarqube.xxxx.xx.xxxxx.xx/api/system/status
	at org.sonarsource.sonarlint.core.util.ws.HttpConnector.doCall(HttpConnector.java:196)
	at org.sonarsource.sonarlint.core.util.ws.HttpConnector.get(HttpConnector.java:122)
	at org.sonarsource.sonarlint.core.util.ws.HttpConnector.call(HttpConnector.java:109)
	at org.sonarsource.sonarlint.core.container.connected.SonarLintWsClient.rawGet(SonarLintWsClient.java:116)
	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:66)
	at org.sonarsource.sonarlint.core.WsHelperImpl.validateConnection(WsHelperImpl.java:59)
	at org.sonarlint.intellij.tasks.ConnectionTestTask.run(ConnectionTestTask.java:53)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:731)
	at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:442)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:586)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:86)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$10(ApplicationImpl.java:594)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:311)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.net.ssl.SSLPeerUnverifiedException: Hostname sonarqube.xxxx.xx.xxxxx.xx not verified:
    certificate: sha256/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
    DN: CN=*.xxxx.xx.xxxxx.xx, OU=SYS, O=, L=, ST=, C=CH
    subjectAltNames: []
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:329)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:282)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.RealConnection.connect(RealConnection.java:167)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at org.sonarsource.sonarlint.shaded.okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
	at org.sonarsource.sonarlint.shaded.okhttp3.RealCall.execute(RealCall.java:77)
	at org.sonarsource.sonarlint.core.util.ws.HttpConnector.doCall(HttpConnector.java:194)
	... 23 more

@Dorian_Magnin your SSL certificate is not correct. Recent version of the HTTP library we are using requires to have the DNS name of the server in subjectAltNames, not in CN (seems that this is the same for modern web browsers anyway).
For more information, please read:
https://github.com/square/okhttp/pull/3764

2 Likes

Hello.

I, too, am having similar issues with “Fail to request”.
Everything used to work, until my company switched the server to HTTPS from HTTP.

I am able to get the status using the browser on the mentioned URL.
I’ve added certs to the truststore.
Am I missing something?
Maybe my certificates are still not correct.

Eclipse 4.4.2
SonarLint 3.6 and 4.1
SonarCube 7.3

Thanks.

Stack Trace

Fail to request https://sonarqube.rjf.com/api/system/status java.lang.IllegalStateException: Fail to request https://sonarqube.rjf.com/api/system/status at org.sonarsource.sonarlint.core.util.ws.HttpConnector.doCall(HttpConnector.java:196) at org.sonarsource.sonarlint.core.util.ws.HttpConnector.get(HttpConnector.java:122) at org.sonarsource.sonarlint.core.util.ws.HttpConnector.call(HttpConnector.java:109) at org.sonarsource.sonarlint.core.container.connected.SonarLintWsClient.rawGet(SonarLintWsClient.java:120) at org.sonarsource.sonarlint.core.container.connected.validate.ServerVersionAndStatusChecker.lambda$fetchServerInfos$0(ServerVersionAndStatusChecker.java:102) at org.sonarsource.sonarlint.core.container.connected.validate.ServerVersionAndStatusChecker$$Lambda$192.000000001F9C9A80.get(Unknown Source) at org.sonarsource.sonarlint.core.container.connected.SonarLintWsClient.processTimed(SonarLintWsClient.java:228) at org.sonarsource.sonarlint.core.container.connected.validate.ServerVersionAndStatusChecker.fetchServerInfos(ServerVersionAndStatusChecker.java:101) at org.sonarsource.sonarlint.core.container.connected.validate.ServerVersionAndStatusChecker.checkVersionAndStatus(ServerVersionAndStatusChecker.java:65) at org.sonarsource.sonarlint.core.container.connected.validate.ServerVersionAndStatusChecker.checkVersionAndStatus(ServerVersionAndStatusChecker.java:55) at org.sonarsource.sonarlint.core.WsHelperImpl.validateConnection(WsHelperImpl.java:69) at org.sonarsource.sonarlint.core.WsHelperImpl.validateConnection(WsHelperImpl.java:62) at org.sonarlint.eclipse.core.internal.server.Server.testConnection(Server.java:423) at org.sonarlint.eclipse.ui.internal.server.wizard.ServerConnectionTestJob.run(ServerConnectionTestJob.java:53) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:221) at java.net.SocketInputStream.read(SocketInputStream.java:152) at com.ibm.jsse2.b.a(b.java:254) at com.ibm.jsse2.b.a(b.java:121) at com.ibm.jsse2.at.a(at.java:462) at com.ibm.jsse2.at.i(at.java:73) at com.ibm.jsse2.at.a(at.java:357) at com.ibm.jsse2.at.startHandshake(at.java:723) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:318) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:282) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.RealConnection.connect(RealConnection.java:167) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at org.sonarsource.sonarlint.shaded.okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at org.sonarsource.sonarlint.shaded.okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) at org.sonarsource.sonarlint.shaded.okhttp3.RealCall.execute(RealCall.java:77) at org.sonarsource.sonarlint.core.util.ws.HttpConnector.doCall(HttpConnector.java:194) ... 14 more

Thank you, that solved my issue