我有这个Java代码
public static void main(String... args) throws IOException, InterruptedException {
execute("echo \"Amer\"");
}
private static void execute(String command) throws IOException, InterruptedException {
ProcessBuilder builder = new ProcessBuilder();
builder.command(command);
//builder.directory(new File(System.getProperty("user.home")));
Process process = builder.start();
StreamGobbler streamGobbler =
new StreamGobbler(process.getInputStream(), System.out::println);
Executors.newSingleThreadExecutor().submit(streamGobbler);
int exitCode = process.waitFor();
assert exitCode == 0;
}
,我正在尝试通过Java操作在Oozie工作流程上运行它 但是当我提交工作流程时,它被以下异常杀死(java.io.IOException:error = 13,权限被拒绝)
org.apache.oozie.action.hadoop.JavaMainException:java.io.IOException: 无法运行程序“ echo“ Amer”“:错误= 13,权限被拒绝 org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:60)在 org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:78) 在org.apache.oozie.action.hadoop.JavaMain.main(JavaMain.java:35)处 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)位于 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498)在 org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:231) 在org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)处 org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:465)在 org.apache.hadoop.mapred.MapTask.run(MapTask.java:349)在 org.apache.hadoop.mapred.YarnChild $ 2.run(YarnChild.java:174)在 java.security.AccessController.doPrivileged(本机方法),位于 javax.security.auth.Subject.doAs(Subject.java:422)在 org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1688) 在org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:168)导致 作者:java.io.IOException:无法运行程序“ echo“ Amer”“:错误= 13, 权限被拒绝 java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)在 ShellCommandExecutor.execute(ShellCommandExecutor.java:18)在 ShellCommandExecutor.main(ShellCommandExecutor.java:11)位于 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)位于 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498)在 org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:57)... 15 更多原因:java.io.IOException:错误= 13,权限被拒绝在 java.lang.UNIXProcess.forkAndExec(本机方法),位于 java.lang.UNIXProcess。(UNIXProcess.java:247)在 java.lang.ProcessImpl.start(ProcessImpl.java:134)在 java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)...还有22个
任何提示吗?