ClickHouse / clickhouse-java

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

Pentaho PDI use JDBC to ClickHouse,Could not initialize class ru.yandex.clickhouse.response.ClickHouseLZ4Stream #250

Closed irislips closed 3 years ago

irislips commented 6 years ago

Error connecting to database [ClickHouse] :org.pentaho.di.core.exception.KettleDatabaseException: Error occurred while trying to connect to the database

Error connecting to database: (using class ru.yandex.clickhouse.ClickHouseDriver) Could not initialize class ru.yandex.clickhouse.response.ClickHouseLZ4Stream

org.pentaho.di.core.exception.KettleDatabaseException: Error occurred while trying to connect to the database

Error connecting to database: (using class ru.yandex.clickhouse.ClickHouseDriver) Could not initialize class ru.yandex.clickhouse.response.ClickHouseLZ4Stream

at org.pentaho.di.core.database.Database.normalConnect(Database.java:472)
at org.pentaho.di.core.database.Database.connect(Database.java:370)
at org.pentaho.di.core.database.Database.connect(Database.java:341)
at org.pentaho.di.core.database.Database.connect(Database.java:331)
at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:80)
at org.pentaho.di.core.database.DatabaseMeta.testConnection(DatabaseMeta.java:2786)
at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:619)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:157)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:141)
at org.pentaho.ui.xul.swt.tags.SwtButton.access$500(SwtButton.java:43)
at org.pentaho.ui.xul.swt.tags.SwtButton$4.widgetSelected(SwtButton.java:137)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
at org.eclipse.jface.window.Window.open(Window.java:796)
at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:80)
at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:47)
at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:118)
at org.pentaho.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:60)
at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.editConnection(SpoonDBDelegate.java:95)
at org.pentaho.di.ui.spoon.Spoon.editConnection(Spoon.java:2787)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:157)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:141)
at org.pentaho.ui.xul.jface.tags.JfaceMenuitem.access$100(JfaceMenuitem.java:43)
at org.pentaho.ui.xul.jface.tags.JfaceMenuitem$1.run(JfaceMenuitem.java:106)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1376)
at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:8161)
at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9523)
at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:702)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92)

Caused by: org.pentaho.di.core.exception.KettleDatabaseException: Error connecting to database: (using class ru.yandex.clickhouse.ClickHouseDriver) Could not initialize class ru.yandex.clickhouse.response.ClickHouseLZ4Stream

at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:585)
at org.pentaho.di.core.database.Database.normalConnect(Database.java:456)
... 56 more

Caused by: java.lang.NoClassDefFoundError: Could not initialize class ru.yandex.clickhouse.response.ClickHouseLZ4Stream at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:728) at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:551) at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:114) at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:97) at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:92) at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:88) at ru.yandex.clickhouse.ClickHouseConnectionImpl.initTimeZone(ClickHouseConnectionImpl.java:86) at ru.yandex.clickhouse.ClickHouseConnectionImpl.(ClickHouseConnectionImpl.java:75) at ru.yandex.clickhouse.ClickHouseDriver.connect(ClickHouseDriver.java:58) at ru.yandex.clickhouse.ClickHouseDriver.connect(ClickHouseDriver.java:50) at ru.yandex.clickhouse.ClickHouseDriver.connect(ClickHouseDriver.java:32) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:208) at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:567) ... 57 more

Custom URL :jdbc:clickhouse://IP:9000/default Custom Driver Class:ru.yandex.clickhouse.ClickHouseDriver

smagellan commented 5 years ago

I believe Pentaho UI can load jar, but can't load transitive dependencies. Try with holy-jar produced by this command, as per README.md:

mvn package assembly:single -DskipTests=true
biwed commented 5 years ago

Для установки соединения нужны файлы:

Jungle666 commented 5 years ago

can this work?

biwed commented 5 years ago

Да работает. В гите создал репозитарий с небольшой интсрукцией. https://github.com/biwed/PDI-clickhouse Это что бы самому не забыть и не качать драйвера постоянно.

lixiaolevae commented 4 years ago

Did that solve?how do you do it?

biwed commented 4 years ago

Hello.

  1. Follow the link to https://github.com/biwed/PDI-clickhouse. There are drivers in the jdbc folder (Clickhouse-jdbc-0.1.50.jar driver version). The all contents of the jdbc folder must be copied to the folder .../data-integration/lib
  2. Restart PDI
  3. Connect using the "Generic Database":
    • Custom connection URL: jdbc:clickhouse://IP:8123/database
    • Custom driver class name: ru.yandex.clickhouse.ClickHouseDriver
wanyaxing commented 4 years ago

I put lz4-java-1.4.jar in the ./lib folder , it worked.

zhicwu commented 3 years ago

Fixed on develop branch and will be merged into master after 0.2.5 release this weekend.

qinlz-1 commented 3 years ago

2021/08/09 18:50:36 - api_log ip.0 - ERROR (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : Unexpected error 2021/08/09 18:50:36 - api_log ip.0 - ERROR (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : org.pentaho.di.core.exception.KettleDatabaseException: 2021/08/09 18:50:36 - api_log ip.0 - Couldn't get row from result set 2021/08/09 18:50:36 - api_log ip.0 - java.text.ParseException: Unparseable date: "2021-08-08" 2021/08/09 18:50:36 - api_log ip.0 - 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2357) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2328) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2306) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.trans.steps.tableinput.TableInput.doQuery(TableInput.java:247) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.trans.steps.tableinput.TableInput.processRow(TableInput.java:138) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62) 2021/08/09 18:50:36 - api_log ip.0 - at java.lang.Thread.run(Thread.java:748) 2021/08/09 18:50:36 - api_log ip.0 - Caused by: java.lang.RuntimeException: java.text.ParseException: Unparseable date: "2021-08-08" 2021/08/09 18:50:36 - api_log ip.0 - at ru.yandex.clickhouse.response.ClickHouseResultSet.toTimestamp(ClickHouseResultSet.java:548) 2021/08/09 18:50:36 - api_log ip.0 - at ru.yandex.clickhouse.response.ClickHouseResultSet.getTimestampAsLong(ClickHouseResultSet.java:382) 2021/08/09 18:50:36 - api_log ip.0 - at ru.yandex.clickhouse.response.ClickHouseResultSet.getTimestamp(ClickHouseResultSet.java:387) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.row.value.ValueMetaBase.getValueFromResultSet(ValueMetaBase.java:4670) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.BaseDatabaseMeta.getValueFromResultSet(BaseDatabaseMeta.java:2086) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.DatabaseMeta.getValueFromResultSet(DatabaseMeta.java:2852) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2349) 2021/08/09 18:50:36 - api_log ip.0 - ... 6 more 2021/08/09 18:50:36 - api_log ip.0 - Caused by: java.text.ParseException: Unparseable date: "2021-08-08" 2021/08/09 18:50:36 - api_log ip.0 - at java.text.DateFormat.parse(DateFormat.java:366) 2021/08/09 18:50:36 - api_log ip.0 - at ru.yandex.clickhouse.response.ClickHouseResultSet.toTimestamp(ClickHouseResultSet.java:546) 2021/08/09 18:50:36 - api_log ip.0 - ... 12 more

Naaraju commented 3 years ago

Thanku @biwed it Worked for me , u made my day

zhicwu commented 3 years ago

Thanku @biwed it Worked for me , and u made my day

If you're seeking for a jar with the driver and all dependencies included, please use shaded jar, for example: https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc/0.3.1-patch/clickhouse-jdbc-0.3.1-patch-shaded.jar. Alternatively, you can download the latest one from here.

Naaraju commented 3 years ago

@zhicwu it is working fine with date fields also Thanku for This New Version ,

Pls lookinto this also if possible when i was connect some Big clickhouse tables in Spoon Table_out_put Step it's Hanging

clickhouse_connection_hanging , how can i achieve this

zhicwu commented 3 years ago

when i was connect some Big clickhouse tables in Spoon Table_out_put Step it's Hanging

How big the table is? How many columns and rows? I think you can check system.query_log on ClickHouse to understand what's the query from PDI causing the problem.

deniztek commented 2 years ago

@zhicwu it is working fine with date fields also Thanku for This New Version ,

Pls lookinto this also if possible when i was connect some Big clickhouse tables in Spoon Table_out_put Step it's Hanging

clickhouse_connection_hanging , how can i achieve this

I have same problem and stuck with it. If you solved the problem, could you explain how you do it )).

LightGao-Hub commented 2 years ago

感谢你@biwed它对我有用,你让我开心

如果您正在寻找包含驱动程序和所有依赖项的 jar,请使用阴影 jar,例如:https ://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc/0.3.1-补丁/clickhouse-jdbc-0.3.1-patch-shaded.jar。或者,您可以从此处下载最新版本。

This really works!

MichaelZalogin commented 8 months ago

2021/08/09 18:50:36 - api_log ip.0 - ERROR (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : Unexpected error 2021/08/09 18:50:36 - api_log ip.0 - ERROR (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : org.pentaho.di.core.exception.KettleDatabaseException: 2021/08/09 18:50:36 - api_log ip.0 - Couldn't get row from result set 2021/08/09 18:50:36 - api_log ip.0 - java.text.ParseException: Unparseable date: "2021-08-08" 2021/08/09 18:50:36 - api_log ip.0 - 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2357) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2328) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2306) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.trans.steps.tableinput.TableInput.doQuery(TableInput.java:247) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.trans.steps.tableinput.TableInput.processRow(TableInput.java:138) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62) 2021/08/09 18:50:36 - api_log ip.0 - at java.lang.Thread.run(Thread.java:748) 2021/08/09 18:50:36 - api_log ip.0 - Caused by: java.lang.RuntimeException: java.text.ParseException: Unparseable date: "2021-08-08" 2021/08/09 18:50:36 - api_log ip.0 - at ru.yandex.clickhouse.response.ClickHouseResultSet.toTimestamp(ClickHouseResultSet.java:548) 2021/08/09 18:50:36 - api_log ip.0 - at ru.yandex.clickhouse.response.ClickHouseResultSet.getTimestampAsLong(ClickHouseResultSet.java:382) 2021/08/09 18:50:36 - api_log ip.0 - at ru.yandex.clickhouse.response.ClickHouseResultSet.getTimestamp(ClickHouseResultSet.java:387) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.row.value.ValueMetaBase.getValueFromResultSet(ValueMetaBase.java:4670) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.BaseDatabaseMeta.getValueFromResultSet(BaseDatabaseMeta.java:2086) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.DatabaseMeta.getValueFromResultSet(DatabaseMeta.java:2852) 2021/08/09 18:50:36 - api_log ip.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2349) 2021/08/09 18:50:36 - api_log ip.0 - ... 6 more 2021/08/09 18:50:36 - api_log ip.0 - Caused by: java.text.ParseException: Unparseable date: "2021-08-08" 2021/08/09 18:50:36 - api_log ip.0 - at java.text.DateFormat.parse(DateFormat.java:366) 2021/08/09 18:50:36 - api_log ip.0 - at ru.yandex.clickhouse.response.ClickHouseResultSet.toTimestamp(ClickHouseResultSet.java:546) 2021/08/09 18:50:36 - api_log ip.0 - ... 12 more

@qinlz-1 hi, how did you solve this problem?)