Skip to content

spirngboot集成启动报错 Method threw java.lang.NullPointerException #758

Closed

Description

@fahualei

ClickHouseConnectionImpl 连接实现类 91行 初始时间、版本查询时,后续LogProxy中有结果集toString调用, 但timezone此时还是null 会出现异常

Activity

  1. zhicwu commented on Nov 22, 2021

    @zhicwu
    Contributor

    Which version of the driver you're using? 0.3.1-patch? Will changing log level to WARN/ERROR help?

  2. fahualei commented on Nov 22, 2021

    @fahualei
    Author
  3. added this to the 0.3.2 Release milestone on Nov 23, 2021
  4. linked a pull request that will close this issueNew JDBC driver #747on Nov 23, 2021
  5. zhicwu commented on Nov 23, 2021

    @zhicwu
    Contributor

    Could you increase log level for ru.yandex package? I've stopped patching the code for a while. In the new JDBC driver, LogProxy has been removed, and I took advice from #697 by adding new options to avoid additional query when initializing connection - something like below:

    ClickHouseConfig config = clientRequest.getConfig();
    String currentDb = null;
    String currentUser = null;
    TimeZone timeZone = null;
    ClickHouseVersion version = null;
    if (config.hasServerInfo()) { // when both serverTimeZone and serverVersion are configured
        timeZone = config.getServerTimeZone();
        version = config.getServerVersion();
    } else {
        try (ClickHouseResponse response = clientRequest.copy().option(ClickHouseClientOption.ASYNC, false)
                .option(ClickHouseClientOption.COMPRESS, false).option(ClickHouseClientOption.DECOMPRESS, false)
                .option(ClickHouseClientOption.FORMAT, ClickHouseFormat.RowBinaryWithNamesAndTypes)
                .query("select currentDatabase(), currentUser(), timezone(), version()").execute().get()) {
            ClickHouseRecord r = response.firstRecord();
            currentDb = r.getValue(0).asString();
            currentUser = r.getValue(1).asString();
            String tz = r.getValue(2).asString();
            String ver = r.getValue(3).asString();
            version = ClickHouseVersion.of(ver);
            if (ClickHouseChecker.isNullOrBlank(tz)) {
                tz = "UTC";
            }
            timeZone = "UTC".equals(tz) ? ClickHouseValues.UTC_TIMEZONE : TimeZone.getTimeZone(tz);
            ...
    }
  6. fahualei commented on Nov 23, 2021

    @fahualei
    Author

    我需要开启TRACE级别输出,尝试使用了0.2.6版本无该问题。好的,既然LogProxy新版本移除了,等新版发布后再尝试升级。

  7. zhicwu commented on Dec 28, 2021

    @zhicwu
    Contributor

    I think you can start to integrate with 0.3.2-test3(batch insertion is not supported very well). 0.3.2 will be released tonight or tomorrow, depending how long it took to run test against batch insertion.

    Update:
    Make sure you use the new JDBC driver com.clickhouse.jdbc.ClickHouseDriver not the old one, which will be removed starting from 0.4.0.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions