无法通过java执行Kettle作业文件

时间:2014-07-01 12:36:21

标签: java java-ee pentaho kettle

这是我第一次处理Pentaho数据集成,所以我正在尝试从java执行这项工作,但我未能做到这一点!虽然这项工作从Spoon开始运作良好。

这是我的代码:

jobMeta = new JobMeta(LogWriter.getInstance(), "E:\\rubbish\\job.kjb", null);
Job job = new Job(LogWriter.getInstance(), null , jobMeta);
job.start();
job.waitUntilFinished();

这是一个错误的结果!:

!INFO  01-07 16:32:03,305 - Using "C:\Users\AALKHA~1\AppData\Local\Temp\vf
_cache" as temporary files store.
ERROR 01-07 16:32:03,468 - null.0 - Unable to read Job Entry copy info from XML
node : org.pentaho.di.core.exception.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL

ERROR 01-07 16:32:03,471 - null.0 - org.pentaho.di.core.exception.KettleStepLoa
erException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL

        at org.pentaho.di.job.entry.JobEntryCopy.<init>(JobEntryCopy.java:110)
        at org.pentaho.di.job.JobMeta.loadXML(JobMeta.java:922)
        at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:726)
        at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:693)
        at ingramint.steps.fullIntStep.step1(fullIntStep.java:62)
        at ingramint.steps.fullIntStep.<init>(fullIntStep.java:32)
        at ingramint.libs.menuLib.mainMenu(menuLib.java:75)
        at ingramint.Main.main(Main.java:24)

Jul 01, 2014 4:32:03 PM ingramint.steps.fullIntStep step1
SEVERE: null
org.pentaho.di.core.exception.KettleXMLException:
Unable to load the job from XML file [E:\rubbish\job.kjb]

Unable to load job info from XML node

Unable to read Job Entry copy info from XML node : org.pentaho.di.core.exceptio
.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL


No valid step/plugin specified (jobPlugin=null) for SPECIAL




        at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:734)
        at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:693)
        at ingramint.steps.fullIntStep.step1(fullIntStep.java:62)
        at ingramint.steps.fullIntStep.<init>(fullIntStep.java:32)
        at ingramint.libs.menuLib.mainMenu(menuLib.java:75)
        at ingramint.Main.main(Main.java:24)
Caused by: org.pentaho.di.core.exception.KettleXMLException:
Unable to load job info from XML node

Unable to read Job Entry copy info from XML node : org.pentaho.di.core.exceptio
.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL


No valid step/plugin specified (jobPlugin=null) for SPECIAL



        at org.pentaho.di.job.JobMeta.loadXML(JobMeta.java:968)
        at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:726)
        ... 5 more
Caused by: org.pentaho.di.core.exception.KettleXMLException:
Unable to read Job Entry copy info from XML node : org.pentaho.di.core.exceptio
.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL


No valid step/plugin specified (jobPlugin=null) for SPECIAL


        at org.pentaho.di.job.entry.JobEntryCopy.<init>(JobEntryCopy.java:134)
        at org.pentaho.di.job.JobMeta.loadXML(JobMeta.java:922)
        ... 6 more
Caused by: org.pentaho.di.core.exception.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL

        at org.pentaho.di.job.entry.JobEntryCopy.<init>(JobEntryCopy.java:110)
        ... 7 more

我正在使用这些罐子:

  • 釜芯3.2.2.jar

  • 釜-DB-3.2.2.jar

  • 釜发动机3.2.2.jar

所以有什么建议吗?

谢谢,

1 个答案:

答案 0 :(得分:0)

一看下面粘贴的代码就可以了。 您需要将data-integration / lib中存在的所有Jars添加到类路径中,而不仅仅是您上面提到的那些。

   public class ExecuteJob {
   public static void main(String[] args) throws Exception {
  String filename = args[0];
  KettleEnvironment.init();
  JobMeta jobMeta = new JobMeta(filename, null);
  Job job = new Job(null, jobMeta);
  job.start();
  job.waitUntilFinished();
  if (job.getErrors()!=0) {
    System.out.println(“Error encountered!”);
 } }
  }