Support Questions

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

Unable to execute HBase MapReduce using hadoop jar

avatar
New Contributor

We have a code to which ingests data from one hbase table to another hbase table using mapreduce using hadoop jar in HDP. Now, we are migrating to CDH 7.1.5. Here when I'm trying to execute the same HBase Mapreduce program using hadoop jar, the code is failing with below error. Can someone help how to resolve this?

 

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
at com.hbase.HbaseTableIngestion.main(HbaseIngestion.java:145)
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:318)
at org.apache.hadoop.util.RunJar.main(RunJar.java:232)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

I guess it's not picking up the hbase related jars. But, I'm not sure how to fix this. It would be really helpful if someone can help.

1 REPLY 1

avatar
Master Collaborator

Please share us the command you run the jar.

Try to add the classpath before hadoop jar like this:

HADOOP_CLASSPATH=/etc/hbase/conf:$(hbase mapredcp) hadoop jar /path/to/jar 

If it solves your problem please accept the answer and click thumbs up.