mapreduce java.lang.ClassNotFoundException:

好久没写mr了,今天写了个在eclipse上运行很顺畅,但是使用hadoop jar命令方式时一直报错:
13/03/07 14:44:34 INFO mapred.JobClient: Task Id : attempt_201303031058_0328_m_000007_0, Status : FAILED
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.test.HBaseToFile$TradeMap
	at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:867)
	at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:199)
	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:719)
	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)
	at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
	at javax.security.auth.Subject.doAs(Subject.java:396)


后来发现原来是在0.20版本以后main方法中需要加:job.setJarByClass(HBaseToFile.class);才能找到自定义的map或reduce内部类。


坑爹吧!

你可能感兴趣的:(mapreduce,hadoop)