ClickHouse / clickhouse-java

ClickHouse Java Clients & JDBC Driver
https://clickhouse.com
Apache License 2.0
1.45k stars 536 forks source link

Failed to start new container: clickhouse-cli-client when use tcp & jdbc to connect clickhouse server. #1530

Open BrockZhou opened 10 months ago

BrockZhou commented 10 months ago

describe

java.sql.SQLException Failed to start new container: clickhouse-cli-client when use tcp & jdbc to connect clickhouse server. Use http is ok

Code example

public class JdbcClient {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        String jdbcDriverClass = "com.clickhouse.jdbc.ClickHouseDriver";
        String jdbcUrl = "jdbc:ch:tcp://127.0.0.1/?connection_timeout=6000";
        Class.forName(jdbcDriverClass);
        Connection conn = DriverManager.getConnection(jdbcUrl, "default", "");
    }
}

Error log

11:22:54.020 [main] DEBUG com.clickhouse.jdbc.ClickHouseDriver - ClickHouse Driver 0.6.0.0(JDBC: 4.2.0.0) registered
11:22:54.038 [main] DEBUG com.clickhouse.jdbc.ClickHouseDriver - Creating connection
11:22:59.128 [main] DEBUG com.clickhouse.client.ClickHouseNodeSelector - Checking [com.clickhouse.client.cli.ClickHouseCommandLineClient@17550481] against [TCP]...
11:22:59.208 [main] DEBUG com.clickhouse.jdbc.internal.ClickHouseConnectionImpl - Connecting to: ClickHouseNode [uri=tcp://127.0.0.1:9000/default, options={connection_timeout=6000}]@-662213436
11:22:59.217 [main] DEBUG com.clickhouse.client.AbstractClient - Connecting to: ClickHouseNode [uri=tcp://127.0.0.1:9000/default, options={connection_timeout=6000}]@-662213436
11:23:29.411 [main] DEBUG com.clickhouse.client.ClickHouseClientBuilder$Agent - Handling java.net.ConnectException: Failed to start new container: clickhouse-cli-client(failover=0, retry=0)
Exception in thread "main" java.sql.SQLException: Failed to start new container: clickhouse-cli-client, server ClickHouseNode [uri=tcp://127.0.0.1:9000/default, options={connection_timeout=6000}]@-662213436
    at com.clickhouse.jdbc.SqlExceptionUtils.handle(SqlExceptionUtils.java:85)
    at com.clickhouse.jdbc.SqlExceptionUtils.create(SqlExceptionUtils.java:31)
    at com.clickhouse.jdbc.SqlExceptionUtils.handle(SqlExceptionUtils.java:90)
    at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.getServerInfo(ClickHouseConnectionImpl.java:131)
    at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.<init>(ClickHouseConnectionImpl.java:335)
    at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.<init>(ClickHouseConnectionImpl.java:288)
    at com.clickhouse.jdbc.ClickHouseDriver.connect(ClickHouseDriver.java:157)
    at com.clickhouse.jdbc.ClickHouseDriver.connect(ClickHouseDriver.java:41)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at com.tl.clickhouse.JdbcClient.main(JdbcClient.java:12)
Caused by: java.net.ConnectException: Failed to start new container: clickhouse-cli-client
    at com.clickhouse.client.cli.ClickHouseCommandLine.dockerCommand(ClickHouseCommandLine.java:169)
    at com.clickhouse.client.cli.ClickHouseCommandLine.startProcess(ClickHouseCommandLine.java:224)
    at com.clickhouse.client.cli.ClickHouseCommandLine.<init>(ClickHouseCommandLine.java:425)
    at com.clickhouse.client.cli.ClickHouseCommandLineClient.newConnection(ClickHouseCommandLineClient.java:50)
    at com.clickhouse.client.cli.ClickHouseCommandLineClient.newConnection(ClickHouseCommandLineClient.java:25)
    at com.clickhouse.client.AbstractClient.getConnection(AbstractClient.java:198)
    at com.clickhouse.client.cli.ClickHouseCommandLineClient.send(ClickHouseCommandLineClient.java:75)
    at com.clickhouse.client.AbstractClient.execute(AbstractClient.java:280)
    at com.clickhouse.client.ClickHouseClientBuilder$Agent.sendOnce(ClickHouseClientBuilder.java:282)
    at com.clickhouse.client.ClickHouseClientBuilder$Agent.send(ClickHouseClientBuilder.java:294)
    at com.clickhouse.client.ClickHouseClientBuilder$Agent.execute(ClickHouseClientBuilder.java:349)
    at com.clickhouse.client.ClickHouseClient.executeAndWait(ClickHouseClient.java:878)
    at com.clickhouse.client.ClickHouseRequest.executeAndWait(ClickHouseRequest.java:2154)
    at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.getServerInfo(ClickHouseConnectionImpl.java:128)
    ... 7 more

Process finished with exit code 1

Configuration

Environment

ClickHouse server

jrnxf commented 9 months ago

Also seeing this