我正在使用HDP 2.0 - hadoop 2.2.0和Apache Avro 1.7.4以及关于新M / R api的followig avro mapreduce指南here
我收到以下错误
2014-07-15 05:46:04,354 FATAL [main] org.apache.hadoop.mapred.YarnChild: Error running child : java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected
at org.apache.avro.mapreduce.AvroKeyInputFormat.createRecordReader(AvroKeyInputFormat.java:47)
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.<init>(MapTask.java:491)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:734)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:339)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:162)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:157)
似乎我正在混合旧的和新的api。有什么猜测? THX
答案 0 :(得分:2)
实际上找到了问题的解决方案。官方报道here
简单的解决方案 - avro需要针对hadoop 2进行编译
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-mapred</artifactId>
<version>1.7.4</version>
<classifier>hadoop2</classifier>
</dependency>
答案 1 :(得分:0)
对我来说,我通过将classifier:"hapdoop2"
添加到build.gradle
文件来解决了这个问题:
avro_mapred : [group:"org.apache.avro", name:"avro-mapred", version:"1.7.7", classifier:"hadoop2"],