在eclipse上运行mapreduce小程序,出现警告提示:No job jar file set.到底是哪里的问题呢?请大神赐教!

小迪儿 2017-04-17 01:38:25
错误提示:

17/04/17 13:22:29 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/04/17 13:22:30 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
17/04/17 13:22:31 WARN mapreduce.JobResourceUploader: No job jar file set. User classes may not be found. See Job or Job#setJar(String).
17/04/17 13:22:31 INFO input.FileInputFormat: Total input paths to process : 3
17/04/17 13:22:32 INFO mapreduce.JobSubmitter: number of splits:3
17/04/17 13:22:32 INFO Configuration.deprecation: mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address
17/04/17 13:22:33 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1492406451078_0001
17/04/17 13:22:33 INFO mapred.YARNRunner: Job jar is not present. Not adding any jar to the list of resources.
17/04/17 13:22:34 INFO impl.YarnClientImpl: Submitted application application_1492406451078_0001
17/04/17 13:22:34 INFO mapreduce.Job: The url to track the job: http://youhuidi-Lenovo-G470:8088/proxy/application_1492406451078_0001/
17/04/17 13:22:34 INFO mapreduce.Job: Running job: job_1492406451078_0001
17/04/17 13:22:45 INFO mapreduce.Job: Job job_1492406451078_0001 running in uber mode : false
17/04/17 13:22:45 INFO mapreduce.Job: map 0% reduce 0%
17/04/17 13:28:50 INFO ipc.Client: Retrying connect to server: youhuidi-Lenovo-G470/127.0.1.1:46461. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=3, sleepTime=1000 MILLISECONDS)
17/04/17 13:28:51 INFO ipc.Client: Retrying connect to server: youhuidi-Lenovo-G470/127.0.1.1:46461. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=3, sleepTime=1000 MILLISECONDS)
17/04/17 13:28:52 INFO ipc.Client: Retrying connect to server: youhuidi-Lenovo-G470/127.0.1.1:46461. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=3, sleepTime=1000 MILLISECONDS)
17/04/17 13:35:13 INFO ipc.Client: Retrying connect to server: youhuidi-Lenovo-G470/127.0.1.1:35093. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=3, sleepTime=1000 MILLISECONDS)
17/04/17 13:35:14 INFO ipc.Client: Retrying connect to server: youhuidi-Lenovo-G470/127.0.1.1:35093. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=3, sleepTime=1000 MILLISECONDS)
17/04/17 13:35:15 INFO ipc.Client: Retrying connect to server: youhuidi-Lenovo-G470/127.0.1.1:35093. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=3, sleepTime=1000 MILLISECONDS)
17/04/17 13:35:15 INFO mapreduce.Job: Job job_1492406451078_0001 failed with state FAILED due to: Application application_1492406451078_0001 failed 2 times due to AM Container for appattempt_1492406451078_0001_000002 exited with exitCode: 0
For more detailed output, check application tracking page:http://youhuidi-Lenovo-G470:8088/cluster/app/application_1492406451078_0001Then, click on links to logs of each attempt.
Diagnostics: Failing this attempt. Failing the application.
17/04/17 13:35:15 INFO mapreduce.Job: Counters: 0


mapreduce小程序代码:

package org.apache.hadoop.examples;


import java.io.IOException;



import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Job;

import org.apache.hadoop.mapreduce.Mapper;

import org.apache.hadoop.mapreduce.Reducer;

import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.util.GenericOptionsParser;



public class WordCount {



//map将输入中的value复制到输出数据的key上,并直接输出

public static class Map extends Mapper<Object,Text,Text,Text>{

private static Text line=new Text();//每行数据



//实现map函数

public void map(Object key,Text value,Context context)

throws IOException,InterruptedException{

line=value;

context.write(line, new Text(""));

}



}



//reduce将输入中的key复制到输出数据的key上,并直接输出

public static class Reduce extends Reducer<Text,Text,Text,Text>{

//实现reduce函数

public void reduce(Text key,Iterable<Text> values,Context context)

throws IOException,InterruptedException{

context.write(key, new Text(""));

}



}



public static void main(String[] args) throws Exception{

Configuration conf = new Configuration();

//这句话很关键

conf.set("mapred.job.tracker", "192.168.1.2:8088");



String[] ioArgs=new String[]{"dedup_in","dedup_out"};

String[] otherArgs = new GenericOptionsParser(conf, ioArgs).getRemainingArgs();

if (otherArgs.length != 2) {

System.err.println("Usage: Data Deduplication <in> <out>");

System.exit(2);

}



@SuppressWarnings("deprecation")
Job job = new Job(conf, "Data Deduplication");

job.setJarByClass(WordCount.class);



//设置Map、Combine和Reduce处理类

job.setMapperClass(Map.class);

job.setCombinerClass(Reduce.class);

job.setReducerClass(Reduce.class);



//设置输出类型

job.setOutputKeyClass(Text.class);

job.setOutputValueClass(Text.class);



//设置输入和输出目录

FileInputFormat.addInputPath(job, new Path(otherArgs[0]));

FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));

System.exit(job.waitForCompletion(true) ? 0 : 1);

}

}
...全文
407 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

20,811

社区成员

发帖
与我相关
我的任务
社区描述
Hadoop生态大数据交流社区,致力于有Hadoop,hive,Spark,Hbase,Flink,ClickHouse,Kafka,数据仓库,大数据集群运维技术分享和交流等。致力于收集优质的博客
社区管理员
  • 分布式计算/Hadoop社区
  • 涤生大数据
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧