|
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... |
|
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 Thanks, this worked! Did not realize CLASSPATH environment variable is not picked up automatically. Have not done Java in a very long time!
(09 Mar '12, 12:17)
tc_dev
|