ClickHouse/clickhouse-java

[client-v2] addEndpoint(String) doesn't enable https protocol

chernser opened this issue · 0 comments

Describe the bug

Steps to reproduce

  1. init client with .addEndpoint("https://some.host.com:8443")
  2. do any query

Expected behavior

No errors

Code example

    public static void main(String... agrs) {
        Client.Builder clientBuilder = new Client.Builder()
                .addEndpoint("https://some.host.com:8443")
                .setUsername("default")
                .setPassword("");

        Client client = clientBuilder.build();

        try {
            CommandResponse response = client.execute("SELECT 1").get(10, TimeUnit.SECONDS);

            System.out.println(response.getServerTime());

        } catch (Exception e) {
            e.printStackTrace();
        }

Error log

java.util.concurrent.ExecutionException: com.clickhouse.client.api.ClientException: Query request failed
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
	at com.clickhouse.testing.SimpleVerification.main(SimpleVerification.java:23)
Caused by: com.clickhouse.client.api.ClientException: Query request failed
	at com.clickhouse.client.api.query.QueryResponse.makeComplete(QueryResponse.java:72)
	at com.clickhouse.client.api.query.QueryResponse.ensureDone(QueryResponse.java:62)
	at com.clickhouse.client.api.Client.lambda$query$4(Client.java:727)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	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:840)
Caused by: java.util.concurrent.ExecutionException: com.clickhouse.client.ClickHouseException: HTTP request failed: https protocol is not supported
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
	at com.clickhouse.client.api.query.QueryResponse.makeComplete(QueryResponse.java:68)
	... 6 more
Caused by: com.clickhouse.client.ClickHouseException: HTTP request failed: https protocol is not supported
	at com.clickhouse.client.ClickHouseException.of(ClickHouseException.java:149)
	at com.clickhouse.client.AbstractClient.lambda$execute$0(AbstractClient.java:275)
	... 4 more
Caused by: java.net.ConnectException: HTTP request failed: https protocol is not supported
	at com.clickhouse.client.http.ApacheHttpConnectionImpl.post(ApacheHttpConnectionImpl.java:258)
	at com.clickhouse.client.http.ClickHouseHttpClient.send(ClickHouseHttpClient.java:194)
	at com.clickhouse.client.AbstractClient.sendAsync(AbstractClient.java:161)
	at com.clickhouse.client.AbstractClient.lambda$execute$0(AbstractClient.java:273)
	... 4 more

Configuration

Environment

  • Client version: 0.6.2
  • Language version: 17
  • OS: Windows