Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Unable to find Kettle Variables for thread

  1. #1
    Join Date
    May 2006
    Posts
    3

    Default Unable to find Kettle Variables for thread

    Hi,
    I'm trying to kick off a Kettle transformation from within my app (via the API). This is my first attempt to do this, so I'm not sure where the problem is. It's a pretty simple test transformation, doesn't require any parameters, etc. First box below shows my code. It throws exception on trying to construct the TransMeta. Exception shown in 2nd box.

    I'm using 2.5RC1

    Any ideas?
    Thank you

    Code:
    static
    {
    
    EnvUtil.environmentInit();
    }
    
    
    public void execute(File file) throws KettleXMLException
    {
    	StepLoader.getInstance().read();
    	JobEntryLoader.getInstance().read();
    	TransMeta transMeta = new TransMeta(filePath);
    	Trans trans = new Trans(LogWriter.getInstance(), transMeta);
    	trans.execute(null);
    	trans.waitUntilFinished();
    }
    Code:
         be.ibridge.kettle.trans.TransMeta: be.ibridge.kettle.trans.TransMeta - java.lang.RuntimeException: Unable to find Kettle Variables for thread [http-8080-Processor25]
    	at be.ibridge.kettle.core.KettleVariables.getInstance(KettleVariables.java:60)
    	at be.ibridge.kettle.core.SharedObjects.createFilename(SharedObjects.java:155)
    	at be.ibridge.kettle.core.SharedObjects.<init>(SharedObjects.java:69)
    	at be.ibridge.kettle.trans.TransMeta.readSharedObjects(TransMeta.java:2978)
    	at be.ibridge.kettle.trans.TransMeta.loadXML(TransMeta.java:2625)
    	at be.ibridge.kettle.trans.TransMeta.<init>(TransMeta.java:2565)
    	at be.ibridge.kettle.trans.TransMeta.<init>(TransMeta.java:2521)
    	at be.ibridge.kettle.trans.TransMeta.<init>(TransMeta.java:2509)

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    You probably are running execute() in a separate thread.
    As such you need to link it up to the oriiginally created KettleVariables in the static section.

    Code:
    LocalVariables.getInstance().createKettleVariables(Thread.currentThread().getName(), parentThreadName, false);

  3. #3
    Join Date
    May 2006
    Posts
    3

    Default

    Thanks for the reply. Sorry for being dense, I'm not super knowledgeable on threads, so I don't know if I implemented your suggestion correctly. But here are a couple things I tried and I'm still having the same problem.

    One other (probably irrelevant) note is that, I can put whatever I want as the file path and I still get the same error. In other words, I can put a path to a bogus file and nothing changes, but I have verified that my 'real' file path does indeed exist. I guess all this tells me is that the error happens sometime before the transformation file is even loaded.

    Thoughts?
    Thank you.

    Code:
    private static String parentThreadName;
    static
    {
    	EnvUtil.environmentInit();
    	parentThreadName = Thread.currentThread().getName();
    }
    
    public void execute(File file) throws KettleXMLException
    {
    	   LocalVariables.getInstance().createKettleVariables(Thread.currentThread().getName(), parentThreadName, false);
    	StepLoader.getInstance().read();
    	JobEntryLoader.getInstance().read();
    	TransMeta transMeta = new TransMeta(file.getPath());
    	Trans trans = new Trans(LogWriter.getInstance(), transMeta);
    	trans.execute(null);
    	trans.waitUntilFinished();
    }



    In this test case, I would think that I was eliminating any potential 'separate thread' issues.
    Code:
    public void execute(File file) throws KettleXMLException
    {
    	EnvUtil.environmentInit();
    	StepLoader.getInstance().read();
    	JobEntryLoader.getInstance().read();
    	TransMeta transMeta = new TransMeta(file.getPath());
    	Trans trans = new Trans(LogWriter.getInstance(), transMeta);
    	trans.execute(null);
    	trans.waitUntilFinished();
    }

  4. #4
    Join Date
    May 2006
    Posts
    3

    Default

    Ok, I think I found the problem. I realized that I never found documentation on how to 'install' this with my app. In other words, I wasn't sure which jars from the libext directory in the Kettle distribution that I needed to bring over. So I had only copied over files from the libext/commons directory, not noticing that there are a bunch of other libs directly in the libext directory itself.
    Anyway, I now copied those over and I don't have the 'variables' error anymore. Now I'm getting a different error "java.lang.NoClassDefFoundError: javax/activation/DataSource", but that again looks like an install issue.
    I will continue working on it, by copying over more libs.

    Thanks

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.