1

我创建了一个 Java 应用程序(试点)来运行水壶转换。这很简单,我只有 main 方法,它获取一个 .ktr 文件并执行它。

public static void main( String[] args )
    {
        try {
            KettleEnvironment.init();
            TransMeta transMeta = new TransMeta("C:\\user\\car.ktr");
            Trans trans = new Trans(transMeta); //create new transformation object
            trans.execute(null);
            trans.waitUntilFinished();
        } catch (KettleException e) {
            e.printStackTrace();
        }
    }

问题是当我运行它时,我得到一个异常。

2014/12/23 08:24:54 - Table output.0 - ERROR (version 5.0.5, build 1 from 2014-03-21_17-56-23 by buildguy) : Error initializing step [Table output]
2014/12/23 08:24:54 - Table output.0 - ERROR (version 5.0.5, build 1 from 2014-03-21_17-56-23 by buildguy) : java.lang.AbstractMethodError
2014/12/23 08:24:54 - Table output.0 -  at org.pentaho.di.core.logging.LoggingObject.grabLoggingObjectInformation(LoggingObject.java:136)
2014/12/23 08:24:54 - Table output.0 -  at org.pentaho.di.core.logging.LoggingObject.<init>(LoggingObject.java:56)
2014/12/23 08:24:54 - Table output.0 -  at org.pentaho.di.core.logging.LoggingRegistry.registerLoggingSource(LoggingRegistry.java:70)
2014/12/23 08:24:54 - Table output.0 -  at org.pentaho.di.core.logging.LogChannel.<init>(LogChannel.java:74)
2014/12/23 08:24:54 - Table output.0 -  at org.pentaho.di.core.database.Database.<init>(Database.java:191)
2014/12/23 08:24:54 - Table output.0 -  at org.pentaho.di.trans.steps.tableoutput.TableOutput.init(TableOutput.java:598)
2014/12/23 08:24:54 - Table output.0 -  at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:65)
2014/12/23 08:24:54 - Table output.0 -  at java.lang.Thread.run(Unknown Source)
2014/12/23 08:24:54 - car - ERROR (version 5.0.5, build 1 from 2014-03-21_17-56-23 by buildguy) : Step [Table output.0] failed to initialize!
org.pentaho.di.core.exception.KettleException: 
We failed to initialize at least one step.  Execution can not begin!


    at org.pentaho.di.trans.Trans.prepareExecution(Trans.java:1068)
    at org.pentaho.di.trans.Trans.execute(Trans.java:578)
    at neoway.com.App.main(App.java:16)

它用 maven 创建了这个应用程序,我有这些依赖项。

   <dependency>
      <groupId>pentaho-kettle</groupId>
      <artifactId>kettle-engine</artifactId>
      <version>5.0.5</version>
   </dependency>
   <dependency>
      <groupId>pentaho-kettle</groupId>
      <artifactId>kettle-db</artifactId>
      <version>4.4.3.3</version>
   </dependency>
   <dependency>
      <groupId>pentaho-kettle</groupId>
      <artifactId>kettle-core</artifactId>
      <version>5.0.5</version>
   </dependency>
   <dependency>
      <groupId>pentaho-kettle</groupId>
      <artifactId>kettle-ui-swt</artifactId>
      <version>5.0.5</version>
   </dependency>
   <dependency>
      <groupId>pentaho-library</groupId>
      <artifactId>libformula</artifactId>
      <version>5.0.5</version>
   </dependency>

有人对这个问题有任何想法吗?

谢谢。

4

1 回答 1

0

您还需要在 pom.xml 文件中添加您的数据库依赖项。由于您的转换(您正在执行的转换)具有数据库连接,因此您需要将相应的 jar 导入到 eclipse 工作区。否则日食会抛出异常。

检查pentaho wiki以及我的这个博客。我使用 postgresql 作为数据库连接。尝试根据您的数据库修改 maven。

希望能帮助到你 :)

于 2015-01-18T17:37:35.173 回答