문제

I'm using hadoop to design mapreduce job. I decided to create a custom InputFormat. When I want to run the job on my Hortonworks Sandbox, I got this error :

Error: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected

According to some topics on forums (like here), it is a version problem : in Hadoop 2.x, TaskAttemptContext is an interface, before it was a class.

Here is my pom.xml file :

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.4</version>
    </dependency>

    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>2.2.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-core</artifactId>
        <version>1.2.1</version>
    </dependency>



    <dependency>
        <groupId>jdk.tools</groupId>
        <artifactId>jdk.tools</artifactId>
        <version>${java.version}</version>
        <scope>system</scope>
        <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>org.apache.mrunit</groupId>
        <artifactId>mrunit</artifactId>
        <version>0.9.0-incubating</version>
        <classifier>hadoop1</classifier>
    </dependency>

</dependencies>

Thanks to help me if you have an idea.

도움이 되었습니까?

해결책

This probably means you compiled your code against an earlier version of Hadoop than you're running on.

This might have something to do with it...

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>2.2.0</version>
</dependency>

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-core</artifactId>
    <version>1.2.1</version>
</dependency>

You have two different versions of Hadoop here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top