Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

error compiling hbase java code

avatar
Super Collaborator

I have Hadoop classpath defined but when I use it as per documentation I am getting error


[root@hadoop1 conf]# hadoop classpath
/usr/hdp/2.6.5.0-292/hadoop/conf:/usr/hdp/2.6.5.0-292/hadoop/lib/*:/usr/hdp/2.6.5.0-292/hadoop/.//*:/usr/hdp/2.6.5.0-292/hadoop-hdfs/./:/usr/hdp/2.6.5.0-292/hadoop-hdfs/lib/*:/usr/hdp/2.6.5.0-292/hadoop-hdfs/.//*:/usr/hdp/2.6.5.0-292/hadoop-yarn/lib/*:/usr/hdp/2.6.5.0-292/hadoop-yarn/.//*:/usr/hdp/2.6.5.0-292/hadoop-mapreduce/lib/*:/usr/hdp/2.6.5.0-292/hadoop-mapreduce/.//*:/usr/jdk64/jdk1.8.0_112/lib/tools.jar:mysql-connector-java-5.1.17.jar:mysql-connector-java.jar:ojdbc6.jar:/usr/hdp/2.6.5.0-292/tez/*:/usr/hdp/2.6.5.0-292/tez/lib/*:/usr/hdp/2.6.5.0-292/tez/conf
[root@hadoop1 conf]#
[root@hadoop1 conf]#
[root@hadoop1 conf]#  echo $JAVA_HOME
/usr/jdk64/jdk1.8.0_112
[root@hadoop1 conf]#
[root@hadoop1 conf]# javac -cp  `hadoop classpath`  TestHbaseTable.java
TestHbaseTable.java:3: error: package org.apache.hadoop.hbase does not exist
import org.apache.hadoop.hbase.HBaseConfiguration;
                              ^
TestHbaseTable.java:4: error: package org.apache.hadoop.hbase does not exist
import org.apache.hadoop.hbase.HColumnDescriptor;
                              ^
TestHbaseTable.java:5: error: package org.apache.hadoop.hbase does not exist
import org.apache.hadoop.hbase.HTableDescriptor;
                              ^
TestHbaseTable.java:6: error: package org.apache.hadoop.hbase.client does not exist
import org.apache.hadoop.hbase.client.HBaseAdmin;
                                     ^
TestHbaseTable.java:12: error: cannot find symbol
    HBaseConfiguration hconfig = new HBaseConfiguration(new Configuration());
    ^
  symbol:   class HBaseConfiguration
  location: class TestHbaseTable
TestHbaseTable.java:12: error: cannot find symbol
    HBaseConfiguration hconfig = new HBaseConfiguration(new Configuration());
                                     ^
1 ACCEPTED SOLUTION

avatar
Master Mentor

@Sami Ahmad

You are adding "hadoop classpath" however you will also need to add "hbase classpath" something like following:

# javap -cp `hadoop classpath`:`hbase classpath`:.:  TestHbaseTable.java

.


View solution in original post

1 REPLY 1

avatar
Master Mentor

@Sami Ahmad

You are adding "hadoop classpath" however you will also need to add "hbase classpath" something like following:

# javap -cp `hadoop classpath`:`hbase classpath`:.:  TestHbaseTable.java

.