【问题标题】:How to execute jar file from pentaho / ETL如何从 pentaho / ETL 执行 jar 文件
【发布时间】:2014-01-02 12:13:06
【问题描述】:

我需要从 pentaho ETL 运行一个 jar 文件。我已将我的 Testvmarguments.jar 文件放入

服务器/数据集成服务器/tomcat/lib

。创建作业,使用 shell 脚本步骤执行 jar 文件

以下是我的日志:-

INFO 02-01 17:05:59,002 - ImageImporter - Start of job execution
INFO 02-01 17:05:59,007 - ImageImporter - Starting entry [Shell] 
INFO 02-01 17:05:59,008 - Shell - Running on platform : Linux
INFO 02-01 17:05:59,008 - Shell - Executing command :    /home/Myname/MyFolder/dummy.txt 
INFO 02-01 17:05:59,014 - Shell -    (stderr) Unable to access jarfile Testvmarguments.jar INFO 02-01    17:05:59,015 - ImageImporter - Finished job entry [Shell]    (result=[false]) 
INFO 02-01 17:05:59,015 - ImageImporter - Job    execution finished 
INFO 02-01 17:05:59,017 - Kitchen - Finished!    ERROR 02-01 17:05:59,017 - Kitchen - Finished with errors 
INFO 02-01 17:05:59,017 - Kitchen - Start=2014/01/02 17:05:56.504,    Stop=2014/01/02 17:05:59.017 
INFO 02-01 17:05:59,017 - Kitchen -    Processing ended after 2 seconds.

有人可以帮助克服上述错误吗?

DI环境下的jar文件..!!!

请在link找到附件

我之所以使用 shell 脚本是为了执行一个带有运行时参数的 jar。

java -Dfilepath=/home/Myfolder/Myname/Test -Dname=Myname -jar Testvmarguments.jar

这是我的一段代码

 package com.alliance.test;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;

public class TestCommandLine
{
  public static void main(String[] args)
    throws Exception
  {
    String filename = null;
    String employeeName = null;
    if (System.getProperty("filepath") != null) {
      filename = System.getProperty("filepath");
    }
    if (System.getProperty("name") != null) {
      employeeName = System.getProperty("name");
    }
    File file = new File(filename + "Test.txt");
    if (!file.exists())
      file.createNewFile();
    FileWriter fw = new FileWriter(file);
    BufferedWriter out = new BufferedWriter(fw);
    out.write(filename + "\n");
    out.write(employeeName);
    out.close();
    fw.close();
  }
}

谢谢, 苏里亚

【问题讨论】:

    标签: pentaho etl jobs kettle


    【解决方案1】:

    不要将其称为外部进程,因为这样您就不需要启动新的虚拟机了。相反,只需将 jar 添加到 lib 文件夹并从 javascript 步骤或 udjc 中调用它

    【讨论】:

    • 从 JS 调用,例如 "var md5_hash = org.apache.commons.codec.digest.DigestUtils.md5Hex(test_value);" 。这是调用类中的方法。我如何使用 JS 执行 jar ... **在此先感谢**@Codek
    • 我已经添加了一段代码和执行jar文件所需的参数,你可以看看@Codek
    • 能否请教一下,这里出了什么问题[link]stackoverflow.com/questions/21568843/…
    【解决方案2】:

    把jar放到data-integration(server/data-integration-server/tomcat)的目录下试试

    【讨论】:

    • 我复制到 libext 目录,仍然 INFO 02-01 17:52:36,800 - Shell - 执行命令:/home/Myname/MyFolder/dummy.txt INFO 02-01 17:52:36,809 - Shell - (stderr) 无法访问 jarfile Testvmarguments.jar @ Rahul
    【解决方案3】:

    我将 jar 复制到 libext 文件夹。 在 JS 步骤中使用了以下语句

    var testval2 = org.wtc.pentaho.PentahoSample.testSample("surya");

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-31
      • 2023-03-06
      • 2018-09-01
      • 1970-01-01
      • 2021-03-06
      相关资源
      最近更新 更多