简体   繁体   English

由于缺少jar,无法配置hive.exec挂钩

[英]Unable to configure hive.exec hooks due to missing jar

I am trying to use Hive and to switch databases using the 'use db' command. 我正在尝试使用Hive并使用'use db'命令切换数据库。 My setup is Hadoop 2.4.0 and Hive 0.13.1. 我的设置是Hadoop 2.4.0和Hive 0.13.1。 I add the following 3 properties to a .settings file 我将以下3个属性添加到.settings文件中

set hive.exec.failure.hooks=org.apache.hadoop.hive.ql.hooks.ATSHook;
set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.ATSHook;
set hive.exec.pre.hooks=org.apache.hadoop.hive.ql.hooks.ATSHook;

I then open hive command line, passing in the .settings file via 'hive -i my.settings' and then I get: 然后,我打开hive命令行,通过“ hive -i my.settings”传入.settings文件,然后得到:

hive> use db;
hive.exec.pre.hooks Class not found:org.apache.hadoop.hive.ql.hooks.ATSHook
FAILED: Hive Internal Error: java.lang.ClassNotFoundException(org.apache.hadoop.hive.ql.hooks.ATSHook)
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

It seems there is a jar missing from my classpath. 我的类路径似乎缺少一个jar。 I tried searching the web for a jar containing "org.apache.hadoop.hive.ql.hooks.ATSHook" class, but have had no luck. 我尝试在网上搜索一个包含“ org.apache.hadoop.hive.ql.hooks.ATSHook”类的jar,但是没有运气。 I tried adding all paths with jars in them from HIVE_HOME to yarn-site.xml via: 我尝试通过以下方式将所有带有jar的路径从HIVE_HOME添加到yarn-site.xml:

<property>
    <name>yarn.application.classpath</name>
    <value>
            ...
            /apps/hive/hive-0.13.1/hcatalog/share/hcatalog/*,
            /apps/hive/hive-0.13.1/hcatalog/share/hcatalog/storage-handlers/hbase/lib/*,
            /apps/hive/hive-0.13.1/hcatalog/share/webhcat/java-client/*,
            /apps/hive/hive-0.13.1/hcatalog/share/webhcat/svr/lib/*,
            /apps/hive/hive-0.13.1/lib/*
    </value>
 </property>

Still no luck. 仍然没有运气。 Does anyone know is there some additional step I need to do configure these properties? 有谁知道我还需要执行一些其他步骤来配置这些属性?

Apparently the jar is only available in the, as yet unreleased, Hive 0.14.0. 显然,该罐仅在尚未发布的Hive 0.14.0中可用。 So I had to download and build Hive according to the directions on the Hive Wiki . 因此,我必须根据Hive Wiki上的说明下载并构建Hive。 Which is simply: 这很简单:

mvn clean install -DskipTests -Phadoop-2

Once that was built I was able to do this: 一旦构建完成,我就可以做到这一点:

  hive> add jar <HIVE_HOME>/ql/target
      > ;

Or by adding this property to hive-site.xml 或通过将此属性添加到hive-site.xml

    <property>
            <name>hive.aux.jars.path</name>
            <value>file:///<HIVE_HOME>/ql/target/hive-exec-0.14.0-SNAPSHOT.jar</value>
    </property>

I also found a nice slide share presentation about plugins . 我还找到了一个有关插件的幻灯片演示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM