今天在用java調(diào)用kjb文件被坑了一天!!!
kjb中訪問的是oracle數(shù)據(jù)庫, 本地測試沒問題發(fā)到測試環(huán)境, 運行報如下錯誤
先說解決方案:
在kettle的可視化操作文件夾的lib包下找commons-collections-3.2.2.jar加到項目依賴中
2020/07/17 18:31:45 - 根據(jù)參數(shù)同步 - Using run configuration [Pentaho local]
2020/07/17 18:31:45 - 根據(jù)參數(shù)同步 - Running transformation using the Kettle execution engine
2020/07/17 18:31:45 - syn_by_param - Dispatching started for transformation [syn_by_param]
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - ERROR (version 9.0.0.0-423, build 9.0.0.0-423 from 2020-01-31 04.53.04 by buildguy) : Error initializing step [根據(jù)條件插入同步數(shù)據(jù)]
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - ERROR (version 9.0.0.0-423, build 9.0.0.0-423 from 2020-01-31 04.53.04 by buildguy) : Error initializing step [根據(jù)傳參刪除數(shù)據(jù)]
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - ERROR (version 9.0.0.0-423, build 9.0.0.0-423 from 2020-01-31 04.53.04 by buildguy) : java.lang.NoClassDefFoundError: Could not initialize class oracle.security.o5logon.O5Logon
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at oracle.jdbc.driver.T4CTTIoauthenticate.(T4CTTIoauthenticate.java:566)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:370)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:546)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:236)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at java.sql.DriverManager.getConnection(DriverManager.java:664)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at java.sql.DriverManager.getConnection(DriverManager.java:208)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:598)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at org.pentaho.di.core.database.Database.normalConnect(Database.java:477)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at org.pentaho.di.core.database.Database.connect(Database.java:389)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at org.pentaho.di.core.database.Database.connect(Database.java:360)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at org.pentaho.di.trans.steps.tableoutput.TableOutput.init(TableOutput.java:533)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:69)
2020/07/17 18:31:45 - 根據(jù)條件插入同步數(shù)據(jù).0 - at java.lang.Thread.run(Thread.java:748)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - ERROR (version 9.0.0.0-423, build 9.0.0.0-423 from 2020-01-31 04.53.04 by buildguy) : java.lang.NoClassDefFoundError: org/apache/commons/collections/IteratorUtils
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at org.pentaho.di.core.ConcurrentMapProperties.propertyNames(ConcurrentMapProperties.java:258)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:175)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:168)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at java.security.AccessController.doPrivileged(Native Method)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at sun.security.provider.SeedGenerator.getSystemEntropy(SeedGenerator.java:168)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at sun.security.provider.SecureRandom$SeederHolder.(SecureRandom.java:201)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:221)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at java.security.SecureRandom.nextBytes(SecureRandom.java:468)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at oracle.security.o5logon.O5Logon.a(Unknown Source)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at oracle.security.o5logon.O5Logon.(Unknown Source)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at oracle.jdbc.driver.T4CTTIoauthenticate.(T4CTTIoauthenticate.java:566)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:370)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:546)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:236)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at java.sql.DriverManager.getConnection(DriverManager.java:664)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at java.sql.DriverManager.getConnection(DriverManager.java:208)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:598)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at org.pentaho.di.core.database.Database.normalConnect(Database.java:477)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at org.pentaho.di.core.database.Database.connect(Database.java:389)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at org.pentaho.di.core.database.Database.connect(Database.java:360)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at org.pentaho.di.trans.steps.sql.ExecSQL.init(ExecSQL.java:297)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:69)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at java.lang.Thread.run(Thread.java:748)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.IteratorUtils
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
2020/07/17 18:31:45 - 根據(jù)傳參刪除數(shù)據(jù).0 - ... 25 more
問題原因:
kettle的kettle-engine-9.0.0.0-423.jar的org.pentaho.di.core.ConcurrentMapProperties 這個類用了
import org.apache.commons.collections.IteratorUtils;
項目中用的是collections4這個jar 導致找不到類
疑問:
目前還有個疑問沒有解決, 當時在排查問題時, 將測試環(huán)境的包下載到本地, 用本地執(zhí)行沒有報上面的錯,
如果有大神知道歡迎留言!!