9

How to add a jar in Zeppelin for %hive interpreter?

I have tried

%z.dep('');
add jar <jar path>

Also zeppelin hive interpreter throws ClassNotFoundException

Adding to ./interpreter/hive/ throughs thrift exception while add jar says file not found.

How to do it? I am trying to add jsonserde.jar by Amazon to parse DynamoDB imports.

4 Answers 4

8

The recommended way is using Zeppelin's Dependency Management

It can add jar file or maven artifact.

the dependency jar will be downloaded to local-repo.

NOTE: If the jar file is compiled from source, when you compile again, it will NOT be synchronised automatically(download again). You need go to interpreter setting, click edit and OK will trigger another download to local-repo.


NOTE: If you use one scala version first, and compiled again with another version. It will report Exception in thread “main” java.lang.NoSuchMethodError: scala.reflect.api.JavaUniverse.runtimeMirror. remove already downloaded jar with rm -rf local-repo/*


NOTE: z.dep is deprecated.

6
  • 1
    This is cool! 1. What is the property name to add a jar which is stored locally on the host 2. What will the relative path from root or from Zeppelin install directory? Commented Aug 11, 2016 at 18:33
  • 1
    I just simply use absolute path. Commented Aug 11, 2016 at 20:07
  • What is the property name that you used? Commented Aug 11, 2016 at 21:29
  • It is NOT in Properties part. it is in Dependencies part Commented Aug 11, 2016 at 21:51
  • I do not have that segment. Possibly the zeppelin version is old. Commented Aug 11, 2016 at 22:07
4

Updated on Zeppelin 0.8.x

You can now load external dependencies or jars using %dep or %spark.dep (if using Spark). Documentation is on zeppline website: Dynamic Dependency Loading

%dep z.load("/path/to/your/packages.jar")

or

%spark.dep
z.reset() // clean up previously added artifact and repository

// add maven repository
z.addRepo("RepoName").url("RepoURL")

// add maven snapshot repository
z.addRepo("RepoName").url("RepoURL").snapshot()

// add credentials for private maven repository
z.addRepo("RepoName").url("RepoURL").username("username").password("password")
2

Example, tested in Zeppelin 0.8.1:

%dep
z.addRepo("Spark Packages Repo").url("http://dl.bintray.com/spark-packages/maven")
z.addRepo("OSS SNAPSHOTS").url("https://oss.sonatype.org/content/repositories/snapshots")
z.load("org.zouzias:spark-lucenerdd_2.11:0.3.7")
0

I have the version 0.5.6 for me the following worked:

%hive
add jar /home/hadoop/jsonserde.jar
1
  • no, it is not working because I am not using hive org.apache.zeppelin.interpreter.InterpreterException: paragraph_1510199763504_1388344895's Interpreter %hiv not found
    – Haha TTpro
    Commented Nov 9, 2017 at 4:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.