Support Questions
Find answers, ask questions, and share your expertise

how to add jar files through hive view on ambari


hello all

I am very new to hadoop and I wanted to add a couple of jar files to be able to perform my queries

I tried using add jars and the path of the jars like I do in the terminal but I get an error

add jar /tmp/udfs/esri-geometry-api.jar /tmp/udfs/spatial-sdk-hadoop.jar;

Error while compiling statement: FAILED: ParseException line 4:0 cannot recognize input near 'add' 'jar' '/' [ERROR_STATUS]

since I am a newbie i dont exactly know how to add them since the path where the jars are located is right, and I am able to do that successfully on the terminal throught he back end.

Kindly if someone could elaborately explain me how to add these jar files, i would be eternally grateful


Accepted Solutions

@Srinivas Santhanam

Add semicolon at the end and make sure that your ambari user is mapped to an OS user that has access to the path

add jar /tmp/udfs/esri-geometry-api.jar;

add jar /tmp/udfs/spatial-sdk-hadoop.jar;

My suggestion is to place these libraries in HDFS with your Ambari user that has hdfs priviles. Such you can have access to the libraries from any node with hive client.


add jar hdfs://whateverhostname:8020/tmp/esri/esri-geometry-api.jar;

If the response addresses your problem, don't forget to vote and accept best answer. It is a stimulus for the effort. Thank you.

View solution in original post


Hi, can you please try to add those jars saparetly?

add jar /tmp/udfs/esri-geometry-api.jar

add jar /tmp/udfs/spatial-sdk-hadoop.jar


Hi, Thanks

I tried to do so, still showing the same error..

ok, then you can also put these required jars inside hive.aux.jars.path through ambari hive conf, jars will get picked automatically.


Hi jitendra,

So i set this property on custom hive-server2 as hive.aux.jars.path and the path right??

and do i have to set 2 different properties for both the jars or use a ',' to seperate both the jars in a single property?

mkdir /usr/hdp/current/hive-server2/auxlib/ on HS2 node.

copy required jars to /usr/hdp/current/hive-server2/auxlib/ loaction.

Added below property into custom hive-server2 and restart the all affected services. And see if that help.



hi Jitendra,

Tried to do as you said

when I tried to execute the query say select * from test.building i got the error

Error while compiling statement: FAILED: RuntimeException java.lang.ClassNotFoundException: com.esri.json.hadoop.UnenclosedJsonInputFormat [ERROR_STATUS]

Looks like it still didn't picked the jar file, lets try another approach.

In file through Ambari.

export HIVE_AUX_JARS_PATH=<jar1 file path>,<jar2 file path>

And restart the services.


Did you mean hive-env template in advance hive-env?

Yes, under same location. just after below line

"# Folder containing extra libraries required for hive compilation/execution can be controlled by: