【发布时间】: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();
}
}
谢谢, 苏里亚
【问题讨论】: