2
votes

I am getting the following error

TestHBase.java:6: error: package org.apache.hadoop.conf does not exist

when trying the following in ubuntu 12.04:

hduser@ubuntu:~$ javac -classpath hbase-0.94.8.jar:hadoop-core-1.1.2.jar TestHBase.java 

I've tried the following:

  • Copying hadoop-core-1.1.2.jar to hbase/lib after renaming the one that comes with hbase: hadoop-core-1.0.4.jar

  • Copying hadoop/lib/commons-*.jar libraries to hbase/lib hduser@ubuntu:~$ hbase/bin/hbase

  • I've checked my hbase classpath and it seems OK:

    $ classpath | tr ":" "\n" | grep hadoop | head
    /home/hduser/hbase/lib/hadoop-core-1.1.2.jar
    /usr/local/hadoop/libexec/../conf
    /usr/local/hadoop/libexec/..
    /usr/local/hadoop/libexec/../hadoop-core-1.1.2.jar
    /usr/local/hadoop/libexec/../lib/asm-3.2.jar
    

I am not sure what else can I try. I would appreciate any help.

The only way the compilation worked for me is by specifying full path:

javac -classpath /home/hduser/hbase/hbase-0.94.8.jar:/home/hduser/hbase/lib/hadoop-core-1.1.2.jar TestHBase.jar

But then I cannot run:

hduser@ubuntu:~$ ls -l

total 56578

-rw-r--r--  1 hduser hadoop     8445 Jun 23 13:17 examples.desktop
drwxr-xr-x 12 hduser hadoop     1024 Jul  6 08:14 hbase
-rw-r--r--  1 hduser hadoop 57691943 Jun 24 21:33 hbase-0.94.8.tar.gz
drwxr-xr-x  6 hduser hadoop     1024 Jun 25 07:14 hdfs-data
drwxr-xr-x  5 hduser hadoop     1024 Jun 25 07:14 hdfs-data-name
-rw-r--r--  1 hduser hadoop     1247 Jul 10 07:18 TestHBase.class
-rw-r--r--  1 hduser hadoop      875 Jul  6 07:03 TestHBase.java
drwxr-xr-x  4 hduser hadoop     1024 Jul  4 07:30 workspace

hduser@ubuntu:~$ java -cp /home/hduser/hbase/bin/hbase classpath TestHBase

Error: Could not find or load main class TestHBase

1

1 Answers

0
votes

Minimally, a Java client needs the following JAR files specified in its CLASSPATH, when connecting to HBase: hbase, hadoop-core, zookeeper, log4j, commons-logging, and commons-lang.

All these jars are present in the HBASE lib folder and ideally you should use these jars.

Assuming you are running in local mode:

  1. Shouldn't you be using the hadoop jar present in the HBASE lib?

  2. Do you have the other jars specified above also in the classpath and also the HBASE conf directory?