Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HTTP] When Apache Http Client is missing in classpath then JDK built-in one is silently selected. #1621

Open
chernser opened this issue Apr 26, 2024 · 1 comment

Comments

@chernser
Copy link
Contributor

Describe the bug

Http client provider is silently fallback to URL Connection client from JDK.

Steps to reproduce

  1. Create application without apache http client dependency
  2. Run application and connect to CH cloud
  3. Execute "select hostname()" with same client several times consequently.
  4. If apache http client is used - then host name in most times will be the same.

Expected behavior

  • user should be notified if failover to not selected http client happens
  • log warning should be printed if no apache http client is present in classpath while it is selected as client provider
@devurandom
Copy link

I actually see a warning in my logs:

2024-05-02T15:49:54.336Z 4cc66bdf97da WARN [com.clickhouse.client.http.ClickHouseHttpConnectionFactory:164] - Error when creating APACHE_HTTP_CLIENT, fall back to HTTP_URL_CONNECTION
                                                       java.lang.Thread.run                           Thread.java:  829
                         java.util.concurrent.ThreadPoolExecutor$Worker.run               ThreadPoolExecutor.java:  628
                          java.util.concurrent.ThreadPoolExecutor.runWorker               ThreadPoolExecutor.java: 1128
                     java.util.concurrent.CompletableFuture$AsyncSupply.run                CompletableFuture.java: 1700
                      com.clickhouse.client.AbstractClient.lambda$execute$0                   AbstractClient.java:  273
                             com.clickhouse.client.AbstractClient.sendAsync                   AbstractClient.java:  161
                       com.clickhouse.client.http.ClickHouseHttpClient.send             ClickHouseHttpClient.java:   90
                         com.clickhouse.client.AbstractClient.getConnection                   AbstractClient.java:  198
              com.clickhouse.client.http.ClickHouseHttpClient.newConnection             ClickHouseHttpClient.java:   26
              com.clickhouse.client.http.ClickHouseHttpClient.newConnection             ClickHouseHttpClient.java:   56
com.clickhouse.client.http.ClickHouseHttpConnectionFactory.createConnection  ClickHouseHttpConnectionFactory.java:   22
                                            java.lang.ClassLoader.loadClass                      ClassLoader.java:  527
                  jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass                     ClassLoaders.java:  178
                           jdk.internal.loader.BuiltinClassLoader.loadClass               BuiltinClassLoader.java:  581
java.lang.ClassNotFoundException: org.apache.hc.core5.http.ClassicHttpRequest
  java.lang.NoClassDefFoundError: org/apache/hc/core5/http/ClassicHttpRequest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants