spark,hadoop交流群,QQ群号:521066396,欢迎加入共同学习,一起进步~
问题:在集群上跑程序遇到如下错误:
16/04/27 19:59:37 INFO mapreduce.Job: map 0% reduce 0%
16/04/27 19:59:37 INFO mapreduce.Job: Job job_1461208377524_0545 failed with state FAILED due to: Application application_1461208377524_0545 failed 2 times due to AM Container for appattempt_1461208377524_0545_000002 exited with exitCode: 1 due to: Exception from container-launch: org.apache.hadoop.util.Shell$ExitCodeException:
org.apache.hadoop.util.Shell$ExitCodeException:
at org.apache.hadoop.util.Shell.runCommand(Shell.java:505)
at org.apache.hadoop.util.Shell.run(Shell.java:418)
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:650)
at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:195)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:300)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:81)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Container exited with a non-zero exit code 1
如果在本地跑就不会出现上述问题。
将程序打成jar包在集群上跑,出现上述问题。
解决方法:
Configuration config = new Configuration();
config.set(“tmpjars”, jarPath);
其中,jarPath为程序中用到的jar包所在路径(无需包含Hadoop运行所需要的jar包)
通过 “conf.set(“tmpjars”, jars);” 可以设置第三方jar。