eclipse下提交job时报错mapred.JobClient: No job jar file set. User classes may not be found.

时间:2022-06-07 09:15:14

windows下,连接远程集群,直接在eclipse里运行mapreduce作业时,

错误信息:

11/10/14 13:52:07 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.
11/10/14 13:52:07 WARN mapred.JobClient: No job jar file set.  User classes may not be found. See JobConf(Class) or JobConf#setJar(String).
11/10/14 13:52:07 INFO input.FileInputFormat: Total input paths to process : 5
11/10/14 13:52:07 INFO mapred.JobClient: Running job: job_201110141041_0014
11/10/14 13:52:08 INFO mapred.JobClient:  map 0% reduce 0%
11/10/14 13:52:19 INFO mapred.JobClient: Task Id : attempt_201110141041_0014_m_000000_0, Status : FAILED
java.lang.RuntimeException: java.lang.ClassNotFoundException: Finger$FingerMapper1
    at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:809)
    at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:157)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:569)

    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305)

。。。。

出错的原因就是找不到Mapper类和Reduce类。

单机运行的时候是不会存在这个问题的,但是现在是提交到远程集群直接运行,就会出现问题了,原因可以参考这篇文章:http://blog.csdn.net/andyelvis/article/details/7706205

解决办法:

将本工程导出jar包放到工程根目录下面,并在提交程序前添加下面的设置

conf.set("mapred.jar", "loadforecast_utils.jar"); //其中loadforecast_utils.jar是你的导出的jar文件名。注意第一个参数不要拼写错了。

重新运行问题解决!