How to include jars in Hive (Amazon Hadoop env)

我是研究僧i 提交于 2019-12-11 05:23:23

问题


I need to include newer protobuf jar (newer than 2.5.0) in Hive. Somehow no matter where I put the jar - it's being pushed to the end of the classpath. How can I make sure that the jar is in the beginning of the classpath of Hive?


回答1:


To add your own jar to the Hive classpath so that it's included in the beginning of the classpath and not overloaded by some hadoop jar you need to set the following Env variable -

export HADOOP_USER_CLASSPATH_FIRST=true

This indicates that the HADOOP_CLASSPATH will gain priority over general hadoop jars.

At Amazon emr instances you can add this to /home/hadoop/conf/hadoop-env.sh, and modify the classpath in this file also.

This is useful when you want to overload jars like protobuf that come with the hadoop general classpath.




回答2:


The other thing you might consider doing is including the protobuf classes in your jar. You would need to build your jar with the assembly plugin, which will those classes. Its an option.



来源:https://stackoverflow.com/questions/38694271/how-to-include-jars-in-hive-amazon-hadoop-env

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