kettle踩坑java.lang.NoClassDefFoundError: Could not initialize class oracle.security.o5logon.O5Logon

今天在用java调用kjb文件被坑了一天!!!
kjb中访问的是oracle数据库, 本地测试没问题发到测试环境, 运行报如下错误
先说解决方案:
在kettle的可视化操作文件夹的lib包下找commons-collections-3.2.2.jar加到项目依赖中

2020/07/17 18:31:45 - 根据参数同步 - Using run configuration [Pentaho local]
2020/07/17 18:31:45 - 根据参数同步 - 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 - 根据条件插入同步数据.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 [根据条件插入同步数据]
2020/07/17 18:31:45 - 根据传参删除数据.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 [根据传参删除数据]
2020/07/17 18:31:45 - 根据条件插入同步数据.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 - 根据条件插入同步数据.0 -    at oracle.jdbc.driver.T4CTTIoauthenticate.(T4CTTIoauthenticate.java:566)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:370)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:546)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:236)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at java.sql.DriverManager.getConnection(DriverManager.java:664)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at java.sql.DriverManager.getConnection(DriverManager.java:208)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:598)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at org.pentaho.di.core.database.Database.normalConnect(Database.java:477)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at org.pentaho.di.core.database.Database.connect(Database.java:389)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at org.pentaho.di.core.database.Database.connect(Database.java:360)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at org.pentaho.di.trans.steps.tableoutput.TableOutput.init(TableOutput.java:533)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:69)
2020/07/17 18:31:45 - 根据条件插入同步数据.0 -    at java.lang.Thread.run(Thread.java:748)
2020/07/17 18:31:45 - 根据传参删除数据.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 - 根据传参删除数据.0 -  at org.pentaho.di.core.ConcurrentMapProperties.propertyNames(ConcurrentMapProperties.java:258)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:175)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:168)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at java.security.AccessController.doPrivileged(Native Method)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at sun.security.provider.SeedGenerator.getSystemEntropy(SeedGenerator.java:168)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at sun.security.provider.SecureRandom$SeederHolder.(SecureRandom.java:201)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:221)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at java.security.SecureRandom.nextBytes(SecureRandom.java:468)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at oracle.security.o5logon.O5Logon.a(Unknown Source)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at oracle.security.o5logon.O5Logon.(Unknown Source)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at oracle.jdbc.driver.T4CTTIoauthenticate.(T4CTTIoauthenticate.java:566)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:370)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:546)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:236)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at java.sql.DriverManager.getConnection(DriverManager.java:664)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at java.sql.DriverManager.getConnection(DriverManager.java:208)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:598)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at org.pentaho.di.core.database.Database.normalConnect(Database.java:477)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at org.pentaho.di.core.database.Database.connect(Database.java:389)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at org.pentaho.di.core.database.Database.connect(Database.java:360)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at org.pentaho.di.trans.steps.sql.ExecSQL.init(ExecSQL.java:297)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:69)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at java.lang.Thread.run(Thread.java:748)
2020/07/17 18:31:45 - 根据传参删除数据.0 - Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.IteratorUtils
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92)
2020/07/17 18:31:45 - 根据传参删除数据.0 -  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
2020/07/17 18:31:45 - 根据传参删除数据.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 导致找不到类

疑问:
目前还有个疑问没有解决, 当时在排查问题时, 将测试环境的包下载到本地, 用本地执行没有报上面的错,
如果有大神知道欢迎留言!!

你可能感兴趣的:(kettle踩坑java.lang.NoClassDefFoundError: Could not initialize class oracle.security.o5logon.O5Logon)