Created 08-17-2017 01:44 PM
i am running my java code to create a table
public static void main(String[] args) throws IOException
{
Configuration conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "sandbox.hortonworks.com");
conf.set("hbase.zookeeper.property.clientPort", "2181");
conf.set("zookeeper.znode.parent", "/hbase-unsecure");
HBaseAdmin admin = new HBaseAdmin(conf);
HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf("people"));
tableDescriptor.addFamily(new HColumnDescriptor("personal"));
tableDescriptor.addFamily(new HColumnDescriptor("contactinfo"));
admin.createTable(tableDescriptor);
Put put = new Put(Bytes.toBytes("doe-john-m-12345"));
}
i build jar of code from maven eclipse and when running the jar in hadoop as:-
hadoop@localhost]$ hadoop jar htable-0.0.1-SNAPSHOT.jar pack.createtable
i am getting:--
java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
at pack.createtable.main(createtable.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:234)
at org.apache.hadoop.util.RunJar.main(RunJar.java:148)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Created 08-17-2017 03:33 PM
Hello,
Ensure that when you submit your job you provide a jar with all the dependency included
Created 08-17-2017 04:02 PM
The output of the following will show what jars are required to connect to HBase
$ hbase classpath
Created 08-18-2017 05:20 AM
Hello, can you please clarify the steps to run the jar..i have set the path as :-
HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HBASE_HOME/lib/* and then running the jar