SonarLint VSCode extension: Connection to SonarQube server not possible

I can’t connect my SonarLint VSCode extension to our company’s SonarQube server.
The server responds on https://sonarqube.<company>.com/api/system/status with:
{“id”:"",“version”:“8.9.2.46101”,“status”:“UP”}

sonarlint-vscode plugin is 3.0.0
VSCode is Version: 1.61.2 (Universal)
Java is Eclipse Temurin 17

The response works with Chrome, curl, and even this minimalist Java program (to check for Java certificate errors):

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;

class Test {
    public static void main(String[] args) {
		try {
			URI sonarqube = new URI("https://sonarqube.<company>.com/api/system/status");
			HttpRequest statusRequest = HttpRequest
				.newBuilder(sonarqube)
				.build();

			HttpResponse<String> response = HttpClient.newBuilder()
				.build()
				.send(statusRequest, BodyHandlers.ofString());

			System.out.println(response);
		} catch (InterruptedException | IOException | URISyntaxException e) { }
    }
}

However, the SonarLint plugin fails to bind to the SonarQube server:

[Error - 11:21:19.145] Error updating the local storage of the connection with id '<default>'
[Error - 11:21:19.146] java.lang.IllegalStateException: Cannot check server version and status
	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:90)
	at org.sonarsource.sonarlint.core.container.connected.ConnectedContainer.update(ConnectedContainer.java:133)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$update$2(ConnectedSonarLintEngineImpl.java:182)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.runInConnectedContainer(ConnectedSonarLintEngineImpl.java:331)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$update$3(ConnectedSonarLintEngineImpl.java:182)
	at org.sonarsource.sonarlint.core.AbstractSonarLintEngine.withRwLock(AbstractSonarLintEngine.java:109)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.update(ConnectedSonarLintEngineImpl.java:177)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.updateGlobalStorageAndLogResults(ProjectBindingManager.java:513)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.createConnectedEngineAndUpdateIfNeeded(ProjectBindingManager.java:264)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.lambda$getOrCreateConnectedEngine$5(ProjectBindingManager.java:242)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.getOrCreateConnectedEngine(ProjectBindingManager.java:241)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.computeProjectBinding(ProjectBindingManager.java:210)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.lambda$getBinding$0(ProjectBindingManager.java:157)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.getBinding(ProjectBindingManager.java:150)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.getBinding(ProjectBindingManager.java:145)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyze(AnalysisManager.java:338)
	at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeAsync$4(AnalysisManager.java:299)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.hc.core5.http.ParseException: Invalid protocol version; error at offset 0: <[0x2e][0x2f][0x30][0x31][0x32][0x33][0x34][0x35][0x36][0x37][0x38][0x39][0x3a][0x3b][0x3c][0x3d][0x3e][0x3f][0x40][0x41]ú[0x43][0x44][0x45][0x46][0x47]@[0x49][0x4a][0x4b][0x4c][0x4d][0x4e]>
	at org.apache.hc.core5.http.message.BasicLineParser.parseProtocolVersion(BasicLineParser.java:110)
	at org.apache.hc.core5.http.message.BasicLineParser.parseStatusLine(BasicLineParser.java:181)
	at org.apache.hc.core5.http.impl.nio.DefaultHttpResponseParser.createMessage(DefaultHttpResponseParser.java:83)
	at org.apache.hc.core5.http.impl.nio.DefaultHttpResponseParser.createMessage(DefaultHttpResponseParser.java:44)
	at org.apache.hc.core5.http.impl.nio.AbstractMessageParser.parseHeadLine(AbstractMessageParser.java:115)
	at org.apache.hc.core5.http.impl.nio.AbstractMessageParser.parse(AbstractMessageParser.java:167)
	at org.apache.hc.core5.http.impl.nio.AbstractMessageParser.parse(AbstractMessageParser.java:51)
	at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.parseMessageHead(AbstractHttp1StreamDuplexer.java:248)
	at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.onInput(AbstractHttp1StreamDuplexer.java:277)
	at org.apache.hc.core5.http.impl.nio.AbstractHttp1IOEventHandler.inputReady(AbstractHttp1IOEventHandler.java:64)
	at org.apache.hc.core5.http.impl.nio.ClientHttp1IOEventHandler.inputReady(ClientHttp1IOEventHandler.java:39)
	at org.apache.hc.core5.reactor.ssl.SSLIOSession.decryptData(SSLIOSession.java:549)
	at org.apache.hc.core5.reactor.ssl.SSLIOSession.access$400(SSLIOSession.java:72)
	at org.apache.hc.core5.reactor.ssl.SSLIOSession$1.inputReady(SSLIOSession.java:172)
	at org.apache.hc.core5.reactor.InternalDataChannel.onIOEvent(InternalDataChannel.java:131)
	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)
	at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:85)
	at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
	... 1 more
	Suppressed: java.lang.NullPointerException: Cannot invoke "org.sonarsource.sonarlint.core.serverapi.HttpClient$Response.code()" because "response" is null
		at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.lambda$rawGetAsync$1(ServerApiHelper.java:109)
		at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
		at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
		at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
		at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162)
		at org.sonarsource.sonarlint.ls.http.ApacheHttpClient$CompletableFutureWrapper.failed(ApacheHttpClient.java:125)
		at org.apache.hc.core5.concurrent.BasicFuture.failed(BasicFuture.java:138)
		at org.apache.hc.core5.concurrent.ComplexFuture.failed(ComplexFuture.java:86)
		at org.apache.hc.client5.http.impl.async.InternalAbstractHttpAsyncClient$1$3.failed(InternalAbstractHttpAsyncClient.java:343)
		at org.apache.hc.client5.http.impl.async.AsyncRedirectExec$1.failed(AsyncRedirectExec.java:246)
		at org.apache.hc.client5.http.impl.async.AsyncHttpRequestRetryExec$1.failed(AsyncHttpRequestRetryExec.java:164)
		at org.apache.hc.client5.http.impl.async.AsyncProtocolExec$1.failed(AsyncProtocolExec.java:261)
		at org.apache.hc.client5.http.impl.async.HttpAsyncMainClientExec$1.failed(HttpAsyncMainClientExec.java:124)
		at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamHandler.failed(ClientHttp1StreamHandler.java:295)
		at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamDuplexer.terminate(ClientHttp1StreamDuplexer.java:193)
		at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.shutdownSession(AbstractHttp1StreamDuplexer.java:156)
		at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.onException(AbstractHttp1StreamDuplexer.java:395)
		at org.apache.hc.core5.http.impl.nio.AbstractHttp1IOEventHandler.inputReady(AbstractHttp1IOEventHandler.java:66)
		... 11 more

Hello, welcome to the community! And thank you for reporting this.

This issue has been fixed in upcoming version 3.1 of SonarLint for VSCode, which should be available in a few hours.

Very nice.

After some restarts of the SonarLint plugin and VSCode, everything seems to work now.

A post was split to a new topic: Unable to connect to SonarCloud: No such host is known (sonarcloud.io)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.