Reply
Contributor
Posts: 26
Registered: ‎04-09-2016
Accepted Solution

Unable to execute add jar command as mentioned in Exercise 2

[ Edited ]

I did finished cloudera exercise 1 successfully on CDH 5 and now I am trying to replicate below same scenario in cloudera url on CDH 5:-


http://www.cloudera.com/developers/get-started-with-hadoop-tutorial/exercise-2.html

 

Exact command cloudera gave is ADD JAR {{lib_dir}}/hive/lib/hive-contrib.jar;

 

Problem is when i issue below command in HIVE query editor:-

 

ADD JAR /home/cloudera/lib/hive-contrib.jar;

 

Hive query editor says:-

Your query has the following error(s):

Error while processing statement: /home/cloudera/lib/hive-contrib.jar does not exist

 

There are 2 issues for which i need solution:-

1)I am unable to find hive/lib directory on CDH 5
2)How to import these jar on on Hive/lib directory

 

My main intention is to get output of below query after invalidate metadata command from Impala 

select count(*),url from tokenized_access_logs
where url like '%\/product\/%'
group by url order by count(*) desc;

 But though i see tokenized_access_logs created at left hand side of HUE but i see no results of above query so i doubt that reason is that add jar command was not executed successfully above hence i am not getting output,can someone suggest how do i successfully execute Add jar command 

 

I have added the screenshot of my VM which shows tokenized_access_logs created but no data when i run 

select count(*),url from tokenized_access_logs
where url like '%\/product\/%'
group by url order by count(*) desc;no results.JPG

 

 

Also added is the error when i ran jar add jar no results.JPG 

Contributor
Posts: 26
Registered: ‎04-09-2016

Re: Unable to find lib path in CDH5 toadd jar using below command on CDH 5

to resolve this i copied hive-contrib.jar from google and copied using wget to /user/hive/lib/ then  i ran query in Impala as 

 

ADD JAR /user/hive/lib/hive-contrib.jar;

 

But below exception thrown

 

AnalysisException: Syntax error in line 1: ADD JAR /user/hive/lib/hive-contrib.jar ^ Encountered: ADD Expected: ALTER, COMPUTE, CREATE, DESCRIBE, DROP, EXPLAIN, GRANT, INSERT, INVALIDATE, LOAD, REFRESH, REVOKE, SELECT, SET, SHOW, TRUNCATE, USE, VALUES, WITH CAUSED BY: Exception: Syntax error

Posts: 1,533
Kudos: 276
Solutions: 233
Registered: ‎07-31-2013

Re: Unable to find lib path in CDH5 toadd jar using below command on CDH 5

> Exact command cloudera gave is ADD JAR {{lib_dir}}/hive/lib/hive-contrib.jar;
> 1)I am unable to find hive/lib directory on CDH 5

The {{lib_dir}} on CDH installed environments for Hive would either be /usr/lib/hive/ or /opt/cloudera/parcels/CDH/lib/hive/ (depending on packages or parcels being in use).
Backline Customer Operations Engineer
Cloudera Employee
Posts: 435
Registered: ‎07-12-2013

Re: Unable to find lib path in CDH5 toadd jar using below command on CDH 5

Note that there are many variables in that tutorial you'll need to replace
with your own values. A copy of the tutorial with all the blanks filled in
and the required datasets are available in the QuickStart VM.
Contributor
Posts: 26
Registered: ‎04-09-2016

Re: Unable to find lib path in CDH5 toadd jar using below command on CDH 5

Thanks Harsha , I mean it

New Contributor
Posts: 1
Registered: ‎11-30-2016

Re: Unable to find lib path in CDH5 toadd jar using below command on CDH 5

for me it works :
/usr/lib/hive/lib/hive-contrib.jar
Highlighted
New Contributor
Posts: 3
Registered: ‎09-22-2017

Re: Unable to execute add jar command as mentioned in Exercise 2

[ Edited ]

I have removed the ADD JAR command (not supported in Impala) for the Tutorial Exercise 2 and Impala at Hue.

It worked, but the data has not been parsed correctly so we should use Hive query editor.

 

Also there is note for HiveServer2 (https://www.cloudera.com/documentation/enterprise/5-6-x/topics/cm_mc_hive_udf.html)

 

We can find the library location in Linux:

 

[cloudera@quickstart hive]$ sudo su -


[root@quickstart ~]# find / -name hive-contrib.jar


/var/lib/hadoop-yarn/cache/yarn/nm-local-dir/usercache/cloudera/filecache/1019/hive-contrib.jar
/var/lib/hadoop-yarn/cache/yarn/nm-local-dir/usercache/cloudera/filecache/114/hive-contrib.jar
/var/lib/hadoop-yarn/cache/yarn/nm-local-dir/usercache/cloudera/filecache/476/hive-contrib.jar
/var/lib/hadoop-yarn/cache/yarn/nm-local-dir/usercache/cloudera/filecache/295/hive-contrib.jar
/var/lib/hadoop-yarn/cache/yarn/nm-local-dir/usercache/cloudera/filecache/838/hive-contrib.jar
/var/lib/hadoop-yarn/cache/yarn/nm-local-dir/usercache/cloudera/filecache/657/hive-contrib.jar
/usr/lib/hive/lib/hive-contrib.jar
/usr/lib/oozie/oozie-sharelib-mr1/lib/hive/hive-contrib.jar
/usr/lib/oozie/oozie-sharelib-yarn/lib/hive/hive-contrib.jar

 

Announcements