hadoop - java.lang. 异常:java.lang. IncompatibleClassChangeError: 找到了接口 org apache hadoop TaskAttemptContext,但需要类

我使用Hadoop 2.4.0和Nutch 2.2收到此异常。

尝试运行此命令时:


./hadoop jar apache-nutch-2.2.1.job org.apache.nutch.crawl.Crawler urls -solr //:8983 -depth 2

我得到:


Java.lang.Exception: java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected
 at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
 at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)
Caused by: java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected
 at org.apache.gora.mapreduce.GoraOutputFormat.getRecordWriter(GoraOutputFormat.java:83)
 at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.<init>(MapTask.java:624)
 at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:744)
 at org.apache.hadoop.mapred.MapTask.run(MapTask.java:340)
 at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:243)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
 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)
14/05/30 02:16:20 INFO mapreduce.Job: Job job_local2137479825_0001 failed with state FAILED due to: NA
14/05/30 02:16:21 INFO mapreduce.Job: Counters: 0
Exception in thread"main" java.lang.RuntimeException: job failed: name=inject urls, jobid=job_local2137479825_0001
 at org.apache.nutch.util.NutchJob.waitForCompletion(NutchJob.java:54)
 at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:233)
 at org.apache.nutch.crawl.Crawler.runTool(Crawler.java:68)
 at org.apache.nutch.crawl.Crawler.run(Crawler.java:136)
 at org.apache.nutch.crawl.Crawler.run(Crawler.java:250)
 at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
 at org.apache.nutch.crawl.Crawler.main(Crawler.java:257)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:606)
 at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

谢谢!

时间:

确保您构建的jar使用与集群上的jar相同的版本 - 特别是hadoop的版本和发行版。

...