Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Do jobs handle Javascript differently than transformations?

  1. #1

    Exclamation Do jobs handle Javascript differently than transformations?

    I've been having an issue with a job/transformation I built with a lot of custom Javascript in the transformation. (The job only calls the one transformation, otherwise it checks that files exist and what-not. It is pretty basic.) When I preview the final output in the transformation everything displays flawlessly and the output file is written. When I run the job, however, it always fails when it reaches the transformation step and always with some Javascript error or another. I'm not sure why it would matter if the transformation is being run as a "Preview" or being called by the job? Has anyone encountered this before?

  2. #2

    Default

    Just a quick addendum - the current error is:
    Code:
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) : Unexpected error
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) : org.pentaho.di.core.exception.KettleValueException: 
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) : Javascript error: 
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) : TypeError: Cannot read property "3" from undefined (script#73)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) : 
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValuesMod.java:457)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.processRow(ScriptValuesMod.java:688)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.pentaho.di.trans.step.RunThread.run(RunThread.java:40)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at java.lang.Thread.run(Unknown Source)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) : Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "3" from undefined (script#73)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3692)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1370)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.gen.c7._c0(script:73)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.gen.c7.call(script)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.gen.c7.call(script)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.mozilla.javascript.gen.c7.exec(script)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValuesMod.java:376)
    2013/09/24 11:30:11 - JS - ParLop.0 - ERROR (version 4.2.1-GA, build 15926 from 2011-10-19 15.36.47 by buildguy) :     ... 3 more
    On the previous run, the Javascript error indicated the problem that Pentaho couldn't split a NULL. The instance of split it referenced in the code was this:

    Code:
    function returnStringWhiteSpaceDelim(stringToBeSplit){
        if (stringToBeSplit && stringToBeSplit.indexOf(" ") != -1){
            return stringToBeSplit.split(" ");
        } else {
            return stringToBeSplit;
        }
    }
    So, basically, if the string is NULL or if the delimiter (whitespace) isn't present, it doesn't even try to split the string. That error disappeared and the error above is referencing this line:

    Code:
    var para = decimalRound(parseFloat(diagnosticsLineSplit[3]),4);
    diagnosticsLineSplit is found if a certain (specified) string is found in the file. The entire line is returned, split along tabs, and then values from the resulting array are stored. I know it's finding the line because (1) it's a required line in the file and (2) it's creating the output file in Preview mode just fine. It's worth mentioning that both test runs were using the same file...

    Any thoughts/advice appreciated...
    Last edited by qanx; 09-24-2013 at 11:52 AM. Reason: clarity

  3. #3

    Default

    UPDATE: The "random" JavaScript errors "resolved" (well, were explained) when I noticed the actual problem was that the transformation was pulling files it wasn't supposed to. See my follow-up question here: http://forums.pentaho.com/showthread...-regex-pattern

Tags for this Thread

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.