SonarQube Server Authentication failing (on SSL-connection)


(Johannes Becker) #1

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


(Adam Gabryś) #2

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:


(Johannes Becker) #3

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.


(Abhishek Chanda) #4

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


(Adam Gabryś) #5

In Eclipse you can find logs on Console tab:


(Abhishek Chanda) #6

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


(Julien Henry) #7

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


(Abhishek Chanda) #8

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


(Julien Henry) #9

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


(Abhishek Chanda) #10

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)

(Nicolas Bontoux) #11

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.