Failed to connect to the server. SonarLint, SonarQube and IntelliJ

Hello,

I made lots of research in order to resolve my problem, but, unfortunately, none of the things that I tried worked for me.
First I configured SonarLint via IntelliJ.
I don’t have any proxy, that why I didn’t have to configure it.
I selected the SonarQube server, I entered the base path of my SonarQube ( https://< hostname >/sonar ). In the next step, I used the Login/Password authentication type, entered my credentials and it ended with this message:

I already tried to:

  • Checked with my browser if my https://< hostname >/sonar/api/system/status page is reachable (and yes, it is);
  • Imported my certificate as a Trusted Certificate (using keytool);
  • Used Token instead of Login/Password connection (and ended in the same error);
  • Added the cert directly in IntelliJ

Some essential information :

  • IntelliJ IDEA 2019.2.4 (Community Edition)
    Build #IC-192.7142.36, built on October 29, 2019
    Runtime version: 11.0.4+10-b304.77 amd64
    VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    Linux 3.10.0-1062.1.1.el7.x86_64
    GC: ParNew, ConcurrentMarkSweep
    Memory: 935M
    Cores: 8
    Registry:
    Non-Bundled Plugins: org.sonarlint.idea
  • SonarLint : 4,2,0,3434
  • SonarQube : Developer edition – Version 7,6
  • CentOS 7.7.1908

And the logs details error:
Connection test failed java.lang.IllegalStateException: Fail to request https://My_SonarqubeHostname/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.SonarLintWsClient.processTimed(SonarLintWsClient.java:227) 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:65) at org.sonarsource.sonarlint.core.WsHelperImpl.validateConnection(WsHelperImpl.java:58) at org.sonarlint.intellij.tasks.ConnectionTestTask.run(ConnectionTestTask.java:53) at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:894) at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:447) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156) at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$9(ApplicationImpl.java:552) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: javax.net.ssl.SSLPeerUnverifiedException: Hostname My_SonarqubeHostname not verified: certificate: My_certificate DN: CN=MY_CN, OU=MY_OU, O=MY_O, L=MY_L, ST=MY_ST, C=MY_C subjectAltNames: [] at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:350) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:300) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.RealConnection.connect(RealConnection.java:185) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169) at org.sonarsource.sonarlint.shaded.okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) at org.sonarsource.sonarlint.shaded.okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) 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:142) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) at org.sonarsource.sonarlint.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) at org.sonarsource.sonarlint.shaded.okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221) at org.sonarsource.sonarlint.shaded.okhttp3.RealCall.execute(RealCall.java:81) at org.sonarsource.sonarlint.core.util.ws.HttpConnector.doCall(HttpConnector.java:194) ... 25 more

Could you help me please?
Thanks in advance!

Sam.

1 Like

Hi @Sam_Sam

Congrats for your issue report, it has all the needed informations :slight_smile:

Caused by: javax.net.ssl.SSLPeerUnverifiedException: Hostname My_SonarqubeHostname not verified: certificate: My_certificate DN: CN=MY_CN, OU=MY_OU, O=MY_O, L=MY_L, ST=MY_ST, C=MY_C subjectAltNames:

This is because your SSL certificate is following an outdated practice, that the library we are using to do HTTP calls have stopped supporting. For more details, see:

You should ask your administrator to fix the certificate, so that your server DNS name appear in subjectAltNames certificate attribute.

1 Like

Thanks you Julien for the answer !
I’ll talk with my administrator and keep you in touch about the issue. :slight_smile:

Sam.

Hi Julien,
We fix our certificate so that our server DNS name appear in subjectAltNames and it worked !
Thanks a lot !

Sam.

1 Like

Great, thanks for the follow up!