GeoIP2-java: Missing jackson.databind in jar?

I’m trying to use this library, but get the error below from the following line:

val file = new File("src/main/resources/GeoLite2-City.mmdb")
val db = new DatabaseReader.Builder(file).withCache(new CHMCache()).build()

yields:

An exception or error caused a run to abort: com.fasterxml.jackson.databind.node.ArrayNode.<init>(Lcom/fasterxml/jackson/databind/node/JsonNodeFactory;Ljava/util/List;)V 
java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.node.ArrayNode.<init>(Lcom/fasterxml/jackson/databind/node/JsonNodeFactory;Ljava/util/List;)V
    at com.maxmind.db.Decoder.decodeArray(Decoder.java:272)
    at com.maxmind.db.Decoder.decodeByType(Decoder.java:156)
    at com.maxmind.db.Decoder.decode(Decoder.java:147)
    at com.maxmind.db.Decoder.decodeMap(Decoder.java:281)
    at com.maxmind.db.Decoder.decodeByType(Decoder.java:154)
    at com.maxmind.db.Decoder.decode(Decoder.java:147)
    at com.maxmind.db.Decoder.decode(Decoder.java:87)
    at com.maxmind.db.Reader.<init>(Reader.java:132)
    at com.maxmind.db.Reader.<init>(Reader.java:116)
    at com.maxmind.geoip2.DatabaseReader.<init>(DatabaseReader.java:39)
    at com.maxmind.geoip2.DatabaseReader.<init>(DatabaseReader.java:27)
    at com.maxmind.geoip2.DatabaseReader$Builder.build(DatabaseReader.java:133)
    at com.sift.etl.processors.IpToLatLong$.<init>(IpToLatLong.scala:22)

Does this indicate the source is missing the jackson.databind.jar? Is it possible I have two conflicting copies of this dependency?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 27 (11 by maintainers)

Most upvoted comments

For people running into this on Spark, the hard minimum dependency in this library may be ignored at runtime because Spark provides its own version (2.4.4 as of Spark 1.6.1). For now I think @laxativessolution is the way to get around this (though I’m not sure why you only had to shade core). For sbt I used the following

assemblyShadeRules in assembly := Seq(
  ShadeRule.rename("com.fasterxml.jackson.core.**"       -> "shadedjackson.core.@1").inAll,
  ShadeRule.rename("com.fasterxml.jackson.annotation.**" -> "shadedjackson.annotation.@1").inAll,
  ShadeRule.rename("com.fasterxml.jackson.databind.**"   -> "shadedjackson.databind.@1").inAll
)

@deepakas, does @sonya’s suggestion above work for you? Alternatively, you could use 2.5.0 of geoip2, which doesn’t require a recent version of Jackson.