By lalith kkvn

2014-08-18 23:01:35 8 Comments

I have a custom hive UDF to access Maxmind's GeoIP-country.mmdb database that is added to the hive resources through "add file pqr.mmdb". The compiled UDF is added as "add jar abc.jar" When I run a hive query, behind the scenes the java class tries to access the data in geo database and fails by throwing the following exception.

Error: java.lang.ClassNotFoundException: com.maxmind.db.Reader$FileMode
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at com.maxmind.geoip2.DatabaseReader$Builder.<init>(

I tried the following two lines separately but it still throws the same error. My database file and jar's are all added to hive resources.

reader = new DatabaseReader.Builder(database).fileMode(Reader.FileMode.MEMORY_MAPPED).build();


reader = new DatabaseReader.Builder(database).fileMode(Reader.FileMode.MEMORY).build();

Has anyone experienced a similar issue ? Thanks ! - Lalith


@Greg Oschwald 2014-08-19 00:55:17

(Moved this to an actual answer.)

The file contains all of the JARs that the API depends on. The ZIP file is created during the build of GeoIP2. The included JARs are all dependencies or dependencies of dependencies listed in the pom.xml file. The zip is listed on the releases page.

Related Questions

Sponsored Content

0 Answered Questions

AWS EMR Hive fails due to serde2/serde

3 Answered Questions

Spark: Hive Insert overwrite throws ClassNotFoundException

1 Answered Questions

Error while launching Hive

2 Answered Questions

Hive - dependencies while running Java Code

  • 2014-07-09 09:30:39
  • user3819715
  • 944 View
  • -5 Score
  • 2 Answer
  • Tags:   java hadoop hive

1 Answered Questions

[SOLVED] HiveServer: ClassNotFound (HiveServer)

  • 2015-02-13 14:34:18
  • Daniel
  • 5365 View
  • 4 Score
  • 1 Answer
  • Tags:   hadoop hive

0 Answered Questions

unable to fetch data from hive through java code in eclipse

1 Answered Questions

[SOLVED] Hive JDBC connection giving NoClassDefFoundError

  • 2014-06-24 11:05:00
  • kn_pavan
  • 9475 View
  • 1 Score
  • 1 Answer
  • Tags:   java jdbc hive

Sponsored Content