最近一直在研究MR作业的问题,在《Hadoop开发者第四期》中运行实例时遇到了如下问题,这个问题还比较常见,乍一看写的源码才发现了问题的所在,首先将错误log贴出:
- 2012-04-13 19:38:07,940 WARN mapred.JobClient - No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String).
- 2012-04-13 19:38:07,956 INFO input.FileInputFormat - Total input paths to process : 1
- 2012-04-13 19:38:08,661 INFO mapred.JobClient - Running job: job_201204121502_0021
- 2012-04-13 19:38:09,664 INFO mapred.JobClient - map 0% reduce 0%
- 2012-04-13 19:38:15,683 INFO mapred.JobClient - Task Id : attempt_201204121502_0021_m_000000_0, Status : FAILED
- java.lang.RuntimeException: java.lang.ClassNotFoundException: com.loogn.cache.JoinWithDistribute$JoinMapper
- at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:996)
- at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:212)
- at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:602)
- at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
- at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
- at java.security.AccessController.doPrivileged(Native Method)
- at javax.security.auth.Subject.doAs(Subject.java:396)
- at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1157)
- at org.apache.hadoop.mapred.Child.main(Child.java:264)
- Caused by: java.lang.ClassNotFoundException: com.loogn.cache.JoinWithDistribute$JoinMapper
- at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
- at java.security.AccessController.doPrivileged(Native Method)
- at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
- at java.lang.ClassLoader.loadClass(Clas
- 2012-04-13 19:38:20,792 INFO mapred.JobClient - Task Id : attempt_201204121502_0021_m_000000_1, Status : FAILED
- java.lang.RuntimeException: java.lang.ClassNotFoundException: com.loogn.cache.JoinWithDistribute$JoinMapper
- at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:996)
- at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:212)
- at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:602)
- at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
- at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
- at java.security.AccessController.doPrivileged(Native Method)
- at javax.security.auth.Subject.doAs(Subject.java:396)
- at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1157)
- at org.apache.hadoop.mapred.Child.main(Child.java:264)
- Caused by: java.lang.ClassNotFoundException: com.loogn.cache.JoinWithDistribute$JoinMapper
- at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
- at java.security.AccessController.doPrivileged(Native Method)
- at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
- at java.lang.ClassLoader.loadClass(Clas
- 2012-04-13 19:38:25,873 INFO mapred.JobClient - Task Id : attempt_201204121502_0021_m_000000_2, Status : FAILED
- java.lang.RuntimeException: java.lang.ClassNotFoundException: com.loogn.cache.JoinWithDistribute$JoinMapper
- at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:996)
- at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:212)
- at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:602)
- at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
- at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
- at java.security.AccessController.doPrivileged(Native Method)
- at javax.security.auth.Subject.doAs(Subject.java:396)
- at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1157)
- at org.apache.hadoop.mapred.Child.main(Child.java:264)
- Caused by: java.lang.ClassNotFoundException: com.loogn.cache.JoinWithDistribute$JoinMapper
- at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
- at java.security.AccessController.doPrivileged(Native Method)
- at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
- at java.lang.ClassLoader.loadClass(Clas
错误为:
No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String).这是因为在写MR作业配置时出了问题,将- conf.set("mapred.jar", jarFile.toString());
中的第一个参数人为地输入错了,在开始时写入是conf.set("mared",jarFile.toString());导致在运行作业时,无法上传jar到集群中,从而分布式系统提示找不到Map类,从而导致整个作业无法完成。
阅读(1945) | 评论(0) | 转发(0) |