Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Move File in javascript fails in linux

  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Exclamation Move File in javascript fails in linux

    Hi!

    I have a transformation that have a javascript step, in it I am creating the full path and filename of the file to move and the destination path with the new filename.

    Then I am calling the move file method in the following way:

    moveFile(src, documentFilename, '');

    src is the source for example:
    /mnt/pentaho_dev/DEV/Technology/Temporal/MOL/AcctStmts/8762000418_201206_07052012_1121_00000000000000009129.pdf

    documentFilename is the destination for example:
    /mnt/ndm_dev/PBI/MOL/Output/JPMX.JPMPDF.MEX.JPMOLP.2012186.001570.ARD.out

    It is working good in windows but in linux I am having the following error:

    ERROR 30-05 11:40:56,050 - Modified Java Script Value 2 - org.pentaho.di.core.exception.KettleValueException:
    Javascript error:
    org.mozilla.javascript.EvaluatorException: The function call moveFile throw an error : org.apache.commons.vfs.FileSystemException: Could not rename "file:///mnt/pentaho_dev/DEV/Technology/Temporal/MOL/AcctStmts/8762000418_201206_07052012_1121_00000000000000009129.pdf" to "file:///mnt/ndm_dev/PBI/MOL/Output/JPMX.JPMPDF.MEX.JPMOLP.2012186.001570.ARD.out". (script#36) (script#36)

    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValuesMod.java:457)
    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.processRow(ScriptValuesMod.java:688)
    at org.pentaho.di.trans.step.RunThread.run(RunThread.java:40)
    at java.lang.Thread.run(Thread.java:636)
    Caused by: org.mozilla.javascript.EvaluatorException: org.mozilla.javascript.EvaluatorException: The function call moveFile throw an error : org.apache.commons.vfs.FileSystemException: Could not rename "file:///mnt/pentaho_dev/DEV/Technology/Temporal/MOL/AcctStmts/8762000418_201206_07052012_1121_00000000000000009129.pdf" to "file:///mnt/ndm_dev/PBI/MOL/Output/JPMX.JPMPDF.MEX.JPMOLP.2012186.001570.ARD.out". (script#36) (script#36)
    at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
    at org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
    at org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesAddedFunctions.moveFile(ScriptValuesAddedFunctions.java:2215)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
    at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:413)
    at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
    at org.mozilla.javascript.gen.c270._c0(script:36)
    at org.mozilla.javascript.gen.c270.call(script)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
    at org.mozilla.javascript.gen.c270.call(script)
    at org.mozilla.javascript.gen.c270.exec(script)
    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValuesMod.java:376)
    ... 3 more

    INFO 30-05 11:40:56,050 - Modified Java Script Value 2 - Finished processing (I=0, O=0, R=1, W=0, U=0, E=1)

    Can anyone help/guide me please?

    Thanks!

  2. #2
    Join Date
    Dec 2009
    Posts
    609

    Default

    Lacking permissions maybe?

  3. #3
    Join Date
    Jul 2012
    Posts
    200

    Default

    Hi,

    Way to run in linux i prefer to write a javascript with mv command which works in unix and use runssh along with that...



    Quote Originally Posted by rbonilla View Post
    Hi!

    I have a transformation that have a javascript step, in it I am creating the full path and filename of the file to move and the destination path with the new filename.

    Then I am calling the move file method in the following way:

    moveFile(src, documentFilename, '');

    src is the source for example:
    /mnt/pentaho_dev/DEV/Technology/Temporal/MOL/AcctStmts/8762000418_201206_07052012_1121_00000000000000009129.pdf

    documentFilename is the destination for example:
    /mnt/ndm_dev/PBI/MOL/Output/JPMX.JPMPDF.MEX.JPMOLP.2012186.001570.ARD.out

    It is working good in windows but in linux I am having the following error:

    ERROR 30-05 11:40:56,050 - Modified Java Script Value 2 - org.pentaho.di.core.exception.KettleValueException:
    Javascript error:
    org.mozilla.javascript.EvaluatorException: The function call moveFile throw an error : org.apache.commons.vfs.FileSystemException: Could not rename "file:///mnt/pentaho_dev/DEV/Technology/Temporal/MOL/AcctStmts/8762000418_201206_07052012_1121_00000000000000009129.pdf" to "file:///mnt/ndm_dev/PBI/MOL/Output/JPMX.JPMPDF.MEX.JPMOLP.2012186.001570.ARD.out". (script#36) (script#36)

    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValuesMod.java:457)
    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.processRow(ScriptValuesMod.java:688)
    at org.pentaho.di.trans.step.RunThread.run(RunThread.java:40)
    at java.lang.Thread.run(Thread.java:636)
    Caused by: org.mozilla.javascript.EvaluatorException: org.mozilla.javascript.EvaluatorException: The function call moveFile throw an error : org.apache.commons.vfs.FileSystemException: Could not rename "file:///mnt/pentaho_dev/DEV/Technology/Temporal/MOL/AcctStmts/8762000418_201206_07052012_1121_00000000000000009129.pdf" to "file:///mnt/ndm_dev/PBI/MOL/Output/JPMX.JPMPDF.MEX.JPMOLP.2012186.001570.ARD.out". (script#36) (script#36)
    at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
    at org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
    at org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesAddedFunctions.moveFile(ScriptValuesAddedFunctions.java:2215)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
    at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:413)
    at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
    at org.mozilla.javascript.gen.c270._c0(script:36)
    at org.mozilla.javascript.gen.c270.call(script)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
    at org.mozilla.javascript.gen.c270.call(script)
    at org.mozilla.javascript.gen.c270.exec(script)
    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValuesMod.java:376)
    ... 3 more

    INFO 30-05 11:40:56,050 - Modified Java Script Value 2 - Finished processing (I=0, O=0, R=1, W=0, U=0, E=1)

    Can anyone help/guide me please?

    Thanks!

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Quote Originally Posted by TomS View Post
    Lacking permissions maybe?
    I bet
    So long, and thanks for all the fish.

  5. #5

    Default

    Have you maybe managed to solve the problem?

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.