Hive shell throws Filenotfound exception while executing queries, inspite of adding jar files using “ADD JAR”

只谈情不闲聊 提交于 2019-12-06 10:55:21

METHOD 1: Copy hive-serdes-1.0-SNAPSHOT.jar file from local filesystem to HDFS.

hadoop fs -mkdir /home/hduser/softwares/hive/
hadoop fs -put /home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar /home/hduser/softwares/hive/

Note: Use hdfs dfs instead of hadoop fs, if you are using latest hadoop versions.

METHOD 2: Change the value for hive.aux.jars.path in hive-site.xml as:

<property>
 <name>hive.aux.jars.path</name>
 <value>file:///home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar</value>
</property>

METHOD 3: Add hive-serdes-1.0-SNAPSHOT.jar in hadoop classpath. i.e., add this line in hadoop-env.sh:

export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:/home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar

NOTE: I have mentioned the paths considering you have installed hive in /home/hduser/softwares/hive. If you have hive installed elsewhere, please change /home/hduser/softwares/hive to point to your hive installation folder.

Check jar exists at /home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar

Note: No need to copy the hive-serdes-1.0-SNAPSHOT.jar in to hdfs, keep it in local Fs itself.

At Query execution time. Hive will take care of it making available in all nodes as D.C

Refer this link for details : official link

FYI - refer Hive Resources

Once a resource is added to a session, Hive queries can refer to it by its name (in map/reduce/transform clauses) and the resource is available locally at execution time on the entire Hadoop cluster. Hive uses Hadoop's Distributed Cache to distribute the added resources to all the machines in the cluster at query execution time

you can add additional Jars in multipe ways:

  • for current hive session:

hive > add jar /local/fs/path/to/your/file.jar

hive > list jars //-- to check

  • Adding on the node from which you are running hive in .hiverc like .bashrc

    cd $HOME

    create a file .hiverc

    cat $HOME/.hiverc

    add jar /local/fs/path/to/your/file.jar // add this line

  • Adding jar file to hive-site.xml

    hive.aux.jars.path file:///home/user/path/to/your/hive-serdes-1.0-SNAPSHOT.jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!