Linux下kettle使用 tdengine 6030数据源 端口遇到的问题解决方案

花了老长时间遇到的问题,解决了,编写blog记录下解决过程

环境:centos7.6

           taos   tdengine-3.0.2.2

           kettle  pdi-ce-9.3.0.0-428

问题:使用kettle连接本机taos数据库,使用com.taosdata.jdbc.TSDBDriver驱动,配置连接串:jdbc:TAOS://192.168.1.10:6030/testdb,测试数据库连接报错:

2024/01/23 10:07:15 - Table input.0 - Finished reading query, closing connection
10:07:55,657 ERROR [AbstractXulDomContainer] Error invoking method: dataHandler.testDatabaseConnection()
java.lang.reflect.InvocationTargetException: null
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_392]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_392]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_392]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_392]
        at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313) [commons-xul-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:157) [commons-xul-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:141) [commons-xul-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.xul.swt.tags.SwtButton.access$500(SwtButton.java:43) [commons-xul-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.xul.swt.tags.SwtButton$4.widgetSelected(SwtButton.java:137) [commons-xul-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252) [swt.jar:?]
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5797) [swt.jar:?]
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5051) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4583) [swt.jar:?]
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:823) [org.eclipse.jface-3.22.0.jar:?]
        at org.eclipse.jface.window.Window.open(Window.java:799) [org.eclipse.jface-3.22.0.jar:?]
        at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:89) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:56) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:124) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:61) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.trans.step.BaseStepDialog.showDbDialogUnlessCancelledOrValid(BaseStepDialog.java:818) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.trans.step.BaseStepDialog$EditConnectionListener.widgetSelected(BaseStepDialog.java:1526) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252) [swt.jar:?]
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5797) [swt.jar:?]
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5051) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4583) [swt.jar:?]
        at org.pentaho.di.ui.trans.steps.tableinput.TableInputDialog.open(TableInputDialog.java:463) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.delegates.SpoonStepsDelegate.editStep(SpoonStepsDelegate.java:120) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.Spoon.editStep(Spoon.java:8871) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.trans.TransGraph.editStep(TransGraph.java:3287) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.trans.TransGraph.mouseDoubleClick(TransGraph.java:785) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:200) [swt.jar:?]
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5797) [swt.jar:?]
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5051) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4583) [swt.jar:?]
        at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1421) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:8006) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9388) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:711) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_392]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_392]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_392]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_392]
        at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92) [launcher.jar:9.3.0.0-428]
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.taosdata.jdbc.TSDBJNIConnector
        at com.taosdata.jdbc.TSDBDriver.connect(TSDBDriver.java:157) ~[taos-jdbcdriver-3.0.2-dist.jar:?]
        at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[?:1.8.0_392]
        at java.sql.DriverManager.getConnection(DriverManager.java:208) ~[?:1.8.0_392]
        at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:589) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.Database.normalConnect(Database.java:481) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.Database.connect(Database.java:389) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.Database.connect(Database.java:360) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.Database.connect(Database.java:350) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:85) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestResults(DatabaseFactory.java:115) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.DatabaseMeta.testConnectionSuccess(DatabaseMeta.java:2859) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:659) ~[kettle-dbdialog-9.3.0.0-428.jar:9.3.0.0-428]
        ... 49 more
10:07:55,693 ERROR [AbstractXulComponent] Error calling oncommand event
org.pentaho.ui.xul.XulException: Error invoking method: dataHandler.testDatabaseConnection()
        at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:317) ~[commons-xul-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:157) [commons-xul-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:141) [commons-xul-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.xul.swt.tags.SwtButton.access$500(SwtButton.java:43) [commons-xul-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.xul.swt.tags.SwtButton$4.widgetSelected(SwtButton.java:137) [commons-xul-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252) [swt.jar:?]
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5797) [swt.jar:?]
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5051) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4583) [swt.jar:?]
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:823) [org.eclipse.jface-3.22.0.jar:?]
        at org.eclipse.jface.window.Window.open(Window.java:799) [org.eclipse.jface-3.22.0.jar:?]
        at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:89) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:56) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:124) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:61) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.trans.step.BaseStepDialog.showDbDialogUnlessCancelledOrValid(BaseStepDialog.java:818) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.trans.step.BaseStepDialog$EditConnectionListener.widgetSelected(BaseStepDialog.java:1526) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252) [swt.jar:?]
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5797) [swt.jar:?]
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5051) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4583) [swt.jar:?]
        at org.pentaho.di.ui.trans.steps.tableinput.TableInputDialog.open(TableInputDialog.java:463) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.delegates.SpoonStepsDelegate.editStep(SpoonStepsDelegate.java:120) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.Spoon.editStep(Spoon.java:8871) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.trans.TransGraph.editStep(TransGraph.java:3287) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.trans.TransGraph.mouseDoubleClick(TransGraph.java:785) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:200) [swt.jar:?]
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5797) [swt.jar:?]
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5051) [swt.jar:?]
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4583) [swt.jar:?]
        at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1421) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:8006) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9388) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:711) [kettle-ui-swt-9.3.0.0-428.jar:9.3.0.0-428]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_392]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_392]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_392]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_392]
        at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92) [launcher.jar:9.3.0.0-428]
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_392]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_392]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_392]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_392]
        at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313) ~[commons-xul-core-9.3.0.0-428.jar:9.3.0.0-428]
        ... 44 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.taosdata.jdbc.TSDBJNIConnector
        at com.taosdata.jdbc.TSDBDriver.connect(TSDBDriver.java:157) ~[taos-jdbcdriver-3.0.2-dist.jar:?]
        at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[?:1.8.0_392]
        at java.sql.DriverManager.getConnection(DriverManager.java:208) ~[?:1.8.0_392]
        at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:589) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.Database.normalConnect(Database.java:481) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.Database.connect(Database.java:389) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.Database.connect(Database.java:360) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.Database.connect(Database.java:350) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:85) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestResults(DatabaseFactory.java:115) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.di.core.database.DatabaseMeta.testConnectionSuccess(DatabaseMeta.java:2859) ~[kettle-core-9.3.0.0-428.jar:9.3.0.0-428]
        at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:659) ~[kettle-dbdialog-9.3.0.0-428.jar:9.3.0.0-428]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_392]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_392]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_392]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_392]
        at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313) ~[commons-xul-core-9.3.0.0-428.jar:9.3.0.0-428]
        ... 44 more

解决办法:

1. kettle中把taos的驱动放置到 data-integration/lib下,注意是dist 包,否则会缺少包依赖

maven:Central Repository: com/taosdata/jdbc/taos-jdbcdriver/3.0.2
2. 把taos的so 驱动安装本kettle所在机器 /usr/local/taos/driver下, 注意操作系统的区别 对应的从相关系统下找taos的so文件,不同的安装介质产生的so文件大小同,注意对应关系,注意必须有:libtaos.so
(ubuntu)
   ls -l /usr/local/taos/driver/
-rwxr-xr-x 1 root root 17885736 Jan 23 12:22 libtaos.so
-rwxr-xr-x 1 root root 17885736 Dec 28  2022 libtaos.so.3.0.2.2
-rwxr-xr-x 1 root root 12178776 Dec 28  2022 libtaosws.so
 (centos)
  ls -l /usr/local/taos/driver/
总用量 47288
-rwxr-xr-x 1 root root 18133496 1月  23 11:30 libtaos.so
-rwxrwxrwx 1 root root 18133496 1月  23 11:30 libtaos.so.3.0.2.2
-rwxrwxrwx 1 root root 12140616 1月  23 11:30 libtaosws.so
-rwxrwxrwx 1 root root        8 1月  22 13:59 vercomp.txt
3. kettle启动脚本spoon.sh 修改
    159             ARCH=`uname -m`
    160                 case $ARCH in
    161                         x86_64)
    162                                 if $($_PENTAHO_JAVA -version 2>&1 | grep "64-Bit" > /dev/null )
    163                                 then
    164                                   LIBPATH=$CURRENTDIR/../libswt/linux/x86_64/
   修改 164行: 为                        LIBPATH=$CURRENTDIR/../libswt/linux/x86_64/:/usr/local/taos/driver/
   因为kettle启动脚本不会把操作系统层面设置的环境变量带进来,所以把需要的环境在启动脚本中添加进来。

问题解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值