我正在使用HDP 2.0 - hadoop 2.2.0和Apache Avro 1.7.4,并遵循Avro mapreduce指南来获取新的M/R api
我得到以下错误
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
实际找到了解决问题的方法。这里有官方报道
简单的解决方案- avro需要在hadoop 2上编译
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-mapred</artifactId>
<version>1.7.4</version>
<classifier>hadoop2</classifier>
</dependency>
对于我来说,我通过将classifier:"hapdoop2"
添加到我们的build.gradle
文件来解决这个问题:
avro_mapred : [group:"org.apache.avro", name:"avro-mapred", version:"1.7.7", classifier:"hadoop2"],