3
votes

I have hadoop and Hbase installed, both working fine as far as I can tell. When trying to the built jar with hadoop, I get a

java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration

error, using Hbase version 0.90.2 in my maven dependency.

I think this is quite an old version of Hbase and I am unsure if this old version is compatible with hadoop 2.7.2 or even Java 8. Thus I tried using Hbase version 0.99.2 in my maven dependency, but then I get a

Failed to execute goal on project exercise_2: Could not resolve dependencies for project com.company.exercise_2:exercise_2:jar:1.0-SNAPSHOT: Failure to find org.apache.hbase:hbase:jar:0.99.2 in http://repo.maven.apache.org/maven2 was cached in the local repository

error from the maven plugin. What am I doing wrong?

Here is my pom.xml:

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-hdfs</artifactId>
    <version>2.7.2</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-mapreduce-client-core</artifactId>
    <version>2.7.2</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>2.7.2</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.apache.hbase</groupId>
    <artifactId>hbase</artifactId>
    <version>0.99.2</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.apache.hbase</groupId>
    <artifactId>hbase-client</artifactId>
    <version>1.1.2</version>
    <scope>provided</scope>
</dependency>
1

1 Answers

1
votes

Seems like this is jar caching issue, I think HbaseConfiguration is common class regardless of which version of hbase used.

Can you manually delete local repository file of hbase and try mvn XXXX command once again.

Maven will then try to download and fix the class path.

for cross checking, use mvn ... -X option to see which version of jar its trying to download.

Since scope of this jar is

provided

Cross check the hbase version of this jar in your cluster. by using "hbase classpath" and check whether this jar version is closely matching with your jar file version of maven repository of your pom.xml.

That should fix.