Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Embedding Kettle inside a web application

  1. #1
    Join Date
    May 2014

    Default Embedding Kettle inside a web application


    I'm using 5.0.2

    I have the following problem -
    I have a .kjb file that activates several .ktr files
    All the files are located under WEB-INF/classes/etl

    I create the job meta using
    JobMeta jobMeta = new JobMeta(getClass().getClassLoader().getResourceAsStream("etl/my_job.kjb", null, null);
    and this step passes successfully.

    than the job is created by
    Job job = new Job(null, jobMeta);
    and when i start the job i get an error

    my_job - Caused by: org.apache.commons.vfs.FileNotFoundException: Could not read from "file:///my_START_JOB.ktr" because it is a not a file.
    my_job - at org.apache.commons.vfs.provider.AbstractFileObject.getInputStream(Unknown Source)
    my_job - at org.apache.commons.vfs.provider.DefaultFileContent.getInputStream(Unknown Source)
    my_job - at org.pentaho.di.core.vfs.KettleVFS.getInputStream(
    my_job - at org.pentaho.di.core.xml.XMLHandler.loadXMLFile(
    my_job - ... 10 more
    my_job - Caused by: /my_START_JOB.ktr (No such file or directory)
    my_job- at Method)
    my_job - at<init>(Unknown Source)
    my_job - at org.apache.commons.vfs.provider.local.LocalFile.doGetInputStream(Unknown Source)
    my_job - ... 14 more
    I got a suggestion to do
    URL r = MyMain.class.getResource("/");
     String decoded_dir = URLDecoder.decode(r.getFile(), "UTF-8");     
    System.setProperty("Internal.Job.Filename.Directory", decoded_dir);
    and i tried all sorts of variations on the string that is entered there - like removing the first / or adding "etl/" at the end but it doesn’t look like the job cares what is in this property and the error messages always remains the same

    I also tried manipulating - "Internal.Transformation.Filename.Directory" - but it didn't work

    i see the API has a method setInternalKettleVariables for both Job and JobMeta -
    is this how i can set
    is it actually the direction to a solution? If yes - can you give some code sample on how to use it?


  2. #2
    Join Date
    May 2014

    Thumbs up Problem solved

    I'm creating the JobMeta with the absolute path the the kjb file and not using the input stream

    URL r = MyVlass.class.getResource("/");
    String decoded_dir = URLDecoder.decode(r.getFile(), "UTF-8");
    JobMeta jobMeta = new JobMeta(decoded_dir + "etl/my_job.kjb", null)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.