I am prototyping a Java/Maven project that needs to directly access HBase. HBase installed successfully and I created tables via shell using examples in the documentation.
I am able to run "mvn package" to build my project, however when trying to run it the HBase class loading always fails. I isolated the problem by simplifying the failing line / exception -
Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.hadoop.hbase.HBaseConfiguration
This seems wrong since I believe CLASSPATH is set correctly before running the project -
export HADOOP_CLASSPATH=`hadoop classpath`
Here is the dependency section from my pom.xml
Why is my code failing? The dependencies worked at compile time...
asked 09 Mar '12, 11:58
You need to add your CLASSPATH to "java" command:
java -cp "all the jars from your CLASSPATH colon separated":target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
answered 09 Mar '12, 12:10