在win上的eclipse进行配置hbase,然后编写一个简单的创建表的操作,使用ant的build.xml进行运行报错:
[sshexec] Connecting to 192.168.60.111:22
[sshexec] cmd : /opt/hadoop/bin/hadoop jar /home/hadoop_jar/HbaseApp1.jar hbasetest.HbaseApp1
[sshexec] Exception in thread "main"
[sshexec] java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
[sshexec]
[sshexec] at hbasetest.HbaseApp1.main(Unknown Source)
[sshexec]
[sshexec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sshexec]
[sshexec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
但是不使用build时,直接点击右键运行时,没有报错:
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
table exists
解决办法:
在hadoop-env.sh文件中增加如下代码
export HADOOP_CLASSPATH=/usr/local/hbase-0.98.8-hadoop2/lib/*