Hi,

I want to remotely submit a job to Yarn on CDH5.4. The following is the code 
about the WordCount and the error report. Any one knows how to solve it?

Thanks in advance,
Fei



INFO: Job job_1439867352386_0025 failed with state FAILED due to: Application 
application_1439867352386_0025 failed 2 times due to AM Container for 
appattempt_1439867352386_0025_000002 exited with  exitCode: 1
For more detailed output, check application tracking 
page:http://compute-04:8088/proxy/application_1439867352386_0025/Then, click on 
links to logs of each attempt.
Diagnostics: Exception from container-launch.
Container id: container_1439867352386_0025_02_000001
Exit code: 1
Stack trace: ExitCodeException exitCode=1: 
        at org.apache.hadoop.util.Shell.runCommand(Shell.java:538)
        at org.apache.hadoop.util.Shell.run(Shell.java:455)
        at 
org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:715)
        at 
org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:211)
        at 
org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
        at 
org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)
        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
Failing this attempt. Failing the application.


public static void main(String[] args) throws Exception {
            Configuration conf = new Configuration();
            System.setProperty("HADOOP_USER_NAME","hdfs");          
            conf.set("hadoop.job.ugi", "supergroup");
            
            conf.set("mapreduce.framework.name", "yarn");
            conf.set("fs.defaultFS", "hdfs://compute-04:8020 
<hdfs://compute-04:8020>");
            conf.set("mapreduce.map.java.opts", "-Xmx1024M");
            conf.set("mapreduce.reduce.java.opts", "-Xmx1024M");
            
            conf.set("fs.hdfs.impl", 
org.apache.hadoop.hdfs.DistributedFileSystem.class.getName());
            conf.set("fs.file.impl", 
org.apache.hadoop.fs.LocalFileSystem.class.getName());
            conf.set("yarn.resourcemanager.address", "199.25.200.134:8032");
            
            conf.set("yarn.resourcemanager.resource-tracker.address", 
"199.25.200.134:8031");
            conf.set("yarn.resourcemanager.scheduler.address", 
"199.25.200.134:8030");
            conf.set("yarn.resourcemanager.admin.address", 
"199.25.200.134:8033");
            
            
            conf.set("yarn.nodemanager.aux-services", "mapreduce_shuffle");
            
            conf.set("yarn.application.classpath", 
"/etc/hadoop/conf.cloudera.hdfs,"
                        + "/etc/hadoop/conf.cloudera.yarn,"
                        + 
"/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/lib/hadoop/*,"
                        + 
"/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/lib/hadoop/lib/*,"
                        + 
"/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/lib/hadoop-hdfs/*,"
                        + 
"/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/lib/hadoop-hdfs/lib/*,"
                        + 
"/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/lib/hadoop-yarn/*,"
                        + 
"/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/lib/hadoop-yarn/lib/*”);
            
            
            GenericOptionsParser optionParser = new GenericOptionsParser(conf, 
args);
            String[] remainingArgs = optionParser.getRemainingArgs();
            if (!(remainingArgs.length != 2 || remainingArgs.length != 4)) {
              System.err.println("Usage: wordcount <in> <out> [-skip 
skipPatternFile]");
              System.exit(2);
            }
            Job job = Job.getInstance(conf, "word count");
            job.setJarByClass(WordCount2.class);
            job.setMapperClass(TokenizerMapper.class);
            job.setCombinerClass(IntSumReducer.class);
            job.setReducerClass(IntSumReducer.class);
            job.setOutputKeyClass(Text.class);
            job.setOutputValueClass(IntWritable.class);

            List<String> otherArgs = new ArrayList<String>();
            for (int i=0; i < remainingArgs.length; ++i) {
              if ("-skip".equals(remainingArgs[i])) {
                job.addCacheFile(new Path(remainingArgs[++i]).toUri());
                job.getConfiguration().setBoolean("wordcount.skip.patterns", 
true);
              } else {
                otherArgs.add(remainingArgs[i]);
              }
            }
            FileInputFormat.addInputPath(job, new Path(otherArgs.get(0)));
            FileOutputFormat.setOutputPath(job, new Path(otherArgs.get(1)));
            
            System.exit(job.waitForCompletion(true) ? 0 : 1);
          }

Reply via email to