itinycheng / flink-connector-clickhouse

Flink SQL connector for ClickHouse. Support ClickHouseCatalog and read/write primary data, maps, arrays to clickhouse.
Apache License 2.0
374 stars 156 forks source link

jar 包放进flink lib 目录出现classnotfind #112

Closed chase-cai-huan closed 7 months ago

chase-cai-huan commented 1 year ago

将打好的flink-connector-clickhouse-1.17.1-SNAPSHOT.jar 放进lib 目录. 使用sql-client , 执行SELECT 发生ClassNotFoundException: org.apache.http.client.utils.URIBuilder 异常,手动添加同版本的依赖又出现NoClassDefFoundError: org/apache/http/client/utils/URIBuilder 异常,请问 这种情况怎么解决,我的flink 版本是1.18

zenoprod commented 1 year ago

有重启flink session嘛

zenoprod commented 1 year ago

兄弟,你的connector能连接clickhouse查询,插入数据嘛

chase-cai-huan commented 1 year ago

兄弟,你的connector能连接clickhouse查询,插入数据嘛 重启了flink, 用sql-client 工具报ClassNotFoundException: org.apache.http.client.utils.URIBuilder 执行第二遍报 NoClassDefFoundError: org/apache/http/client/utils/URIBuilder

错误信息: Caused by: org.apache.flink.table.gateway.api.utils.SqlGatewayException: Failed to fetchResults. at org.apache.flink.table.gateway.service.SqlGatewayServiceImpl.fetchResults(SqlGatewayServiceImpl.java:229) at org.apache.flink.table.gateway.rest.handler.statement.FetchResultsHandler.handleRequest(FetchResultsHandler.java:83) ... 48 more Caused by: org.apache.flink.table.gateway.service.utils.SqlExecutionException: Failed to execute the operation 1965600f-bd83-431c-bd02-d8e8d302f0cd. at org.apache.flink.table.gateway.service.operation.OperationManager$Operation.processThrowable(OperationManager.java:414) at org.apache.flink.table.gateway.service.operation.OperationManager$Operation.lambda$run$0(OperationManager.java:267) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more Caused by: java.lang.NoClassDefFoundError: org/apache/http/client/utils/URIBuilder at org.apache.flink.connector.clickhouse.util.ClickHouseUtil.getJdbcUrl(ClickHouseUtil.java:35) at org.apache.flink.connector.clickhouse.internal.connection.ClickHouseConnectionProvider.createConnection(ClickHouseConnectionProvider.java:114) at org.apache.flink.connector.clickhouse.internal.connection.ClickHouseConnectionProvider.getOrCreateConnection(ClickHouseConnectionProvider.java:61) at org.apache.flink.connector.clickhouse.internal.AbstractClickHouseInputFormat$Builder.build(AbstractClickHouseInputFormat.java:192) at org.apache.flink.connector.clickhouse.ClickHouseDynamicTableSource.getScanRuntimeProvider(ClickHouseDynamicTableSource.java:111) at org.apache.flink.table.planner.connectors.DynamicSourceUtils.validateScanSource(DynamicSourceUtils.java:466) at org.apache.flink.table.planner.connectors.DynamicSourceUtils.prepareDynamicSource(DynamicSourceUtils.java:161) at org.apache.flink.table.planner.connectors.DynamicSourceUtils.convertSourceToRel(DynamicSourceUtils.java:125) at org.apache.flink.table.planner.plan.schema.CatalogSourceTable.toRel(CatalogSourceTable.java:118) at org.apache.calcite.sql2rel.SqlToRelConverter.toRel(SqlToRelConverter.java:3743) at org.apache.calcite.sql2rel.SqlToRelConverter.convertIdentifier(SqlToRelConverter.java:2666) at org.apache.calcite.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:2233) at org.apache.calcite.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:2147) at org.apache.calcite.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:2092) at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:700) at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:686) at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3589) at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:599) at org.apache.flink.table.planner.calcite.FlinkPlannerImpl.org$apache$flink$table$planner$calcite$FlinkPlannerImpl$$rel(FlinkPlannerImpl.scala:216) at org.apache.flink.table.planner.calcite.FlinkPlannerImpl.rel(FlinkPlannerImpl.scala:192) at org.apache.flink.table.planner.operations.SqlToOperationConverter.toQueryOperation(SqlToOperationConverter.java:1580) at org.apache.flink.table.planner.operations.SqlToOperationConverter.convertSqlQuery(SqlToOperationConverter.java:1285) at org.apache.flink.table.planner.operations.SqlToOperationConverter.convertValidatedSqlNode(SqlToOperationConverter.java:397) at org.apache.flink.table.planner.operations.SqlToOperationConverter.convert(SqlToOperationConverter.java:282) at org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:106) at org.apache.flink.table.gateway.service.operation.OperationExecutor.executeStatement(OperationExecutor.java:186) at org.apache.flink.table.gateway.service.SqlGatewayServiceImpl.lambda$executeStatement$1(SqlGatewayServiceImpl.java:212) at org.apache.flink.table.gateway.service.operation.OperationManager.lambda$submitOperation$1(OperationManager.java:119) at org.apache.flink.table.gateway.service.operation.OperationManager$Operation.lambda$run$0(OperationManager.java:258)

itinycheng commented 1 year ago

@chase-cai-huan 您好,master branch 还在 @czy006 的主导开发中; 你可以使用release-1.16进行打包编译(修改pom的flink依赖版本); 一般情况下,NoClassDefFoundError是因包依赖版本冲突导致的(classpath下有多个版本的包,互相不兼容),可以通过shade package 进行修复,关注项目中的maven-shade-plugin配置;

chase-cai-huan commented 1 year ago

@chase-cai-huan 您好,master branch 还在 @czy006 的主导开发中; 你可以使用release-1.16进行打包编译(修改pom的flink依赖版本); 一般情况下,NoClassDefFoundError是因包依赖版本冲突导致的(classpath下有多个版本的包,互相不兼容),可以通过shade package 进行修复,关注项目中的maven-shade-plugin配置;

这边已经通过 修改 maven-shade-plugin 相关配置解决问题了,thanks

czy006 commented 7 months ago

@chase-cai-huan if have any question. welcome open issues