我正在使用 Hadoop-1.2.0、HBase-0.95.0-Hadoop1 并尝试将 Hive-0.11.0 集成到其中。Hadoop 和 HBase 正在运行。
我能够连接到 Hive 并在 Hive 中独立执行语句。但是当我尝试通过 Hive 在 HBase 中创建表时,它给了我以下异常:
kanmani@kanmani-VirtualBox:~/hadoop$ jps
6695 HRegionServer
2640 DataNode
7301 Jps
2969 JobTracker
6404 HMaster
3192 TaskTracker
2861 SecondaryNameNode
2413 NameNode
6508 Main
6368 HQuorumPeer
kanmani@kanmani-VirtualBox:~/hadoop$ hive/bin/hive
Logging initialized using configuration in jar:file:/home/kanmani/hadoop/hive/lib/hive-common-0.11.0.jar!/hive-log4j.properties
Hive history file=/home/kanmani/hadoop/hive/logs/hive_job_log_kanmani_7363@kanmani-VirtualBox_201306081006_284888583.txt
hive>
hive> show tables;
OK
test
Time taken: 18.74 seconds, Fetched: 1 row(s)
hive> create table pokes(foo int,value string);
OK
Time taken: 3.606 seconds
hive> CREATE TABLE hbase_table(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:val") TBLPROPERTIES ("hbase.table.name" = "xyz");
例外:
java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at org.apache.hadoop.hive.ql.metadata.HiveUtils.getStorageHandler(HiveUtils.java:287)
at org.apache.hadoop.hive.ql.metadata.Table.getStorageHandler(Table.java:281)
at org.apache.hadoop.hive.ql.exec.DDLTask.createTable(DDLTask.java:3648)
at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:256)
at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:144)
at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:57)
at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1355)
at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1139)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:945)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:259)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:216)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:413)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:756)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.util.RunJar.main(RunJar.java:160)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.MasterNotRunningException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 21 more
FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.DDLTask
我需要使用从一开始就使用的相同版本的 Hadoop、Hbase。但应该能够毫无问题地将 Hive 与 Hbase 集成。希望有人能在这种情况下帮助我解决我的问题。