最近为了规范hadoop团队的开发流程,所以已经在Eclipse里进行相关的hive开发工作。
但是目前在运行hive的时候,有几个问题需要注意下:
第一个问题:
直接运行CliDriver类报错,信息如下:
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Exception in thread "main" java.lang.RuntimeException: Failed to load Hive builtin functions
at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:205)
at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:81)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:579)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:557)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:127)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at java.util.jar.JarFile.<init>(JarFile.java:72)
at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:72)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:48)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:55)
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:132)
at java.net.URL.openStream(URL.java:1010)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerFunctionsFromPluginJar(FunctionRegistry.java:1226)
at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:202)
... 3 more
解决方式:
在对应的bin目录下将BuiltinUtils.class删除(路径在bin目录下的org/apache/hive/builtins/),使用hive里的builtins的jar(在hive部署的目录下$HIVE_HOME/lib/)。
这样操作完成后运行就正常了,运行情况如下:
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in file:/Users/chenyi8888/Documents/hadoop_dev/hive_0_9_0/bin/hive-log4j.properties
Hive history file=/tmp/chenyi8888/hive_job_log_chenyi8888_201210091518_879179594.txt
2012-10-09 15:18:53.286 java[1032:1203] Unable to load realm info from SCDynamicStore
hive>
第二问题就是开发环境问题,
目前在MAC OS下运行正常,但是在Ubuntu下面就会出现Eclipse死掉了。
原因是jline里的一个ConsoleReader这个类在创建的时候导致Eclipse死掉(如果将jline相关的代码注释掉,即可运行),而且目前不只是一台ubuntu的机器这样。
目前官方文档上是这样介绍的:
The platforms on which JLine has been confirmed to work are:
- Microsoft Windows XP
- RedHat Linux 9.0
- Debian Linux 3.0
- Macintosh OS X 10.3
该问题被解决了,因为是jline在eclipse里的运行有问题,需要设置参数,步骤如下:
在运行CliDriver类之前设置下VM的参数
-Djline.terminal=jline.UnsupportedTerminal
详细内容参考: