Enable Jackson module

In my application (using Play 2.8) I need to add hibernate-types that since version 2.9.12 depends on jackson-module-jaxb-annotations.

If I’m adding this version of the library my application doesn’t start (versions < 2.9.12 work). I get this error:

com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.10.3 requires Jackson Databind version >= 2.10.0 and < 2.11.0

So I’m trying to enable the Jackson module in my application.conf. Following the official play documentation.

I’ve tried with:

akka.serialization.jackson.play.jackson-modules += "com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule"

and also with:

akka.serialization.play.jackson {
    jackson-modules += "com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule"
}

But with no luck. What I’m doing wrong?

This sounds to me like you bumped up your Jackson version. Play comes with some Jackson dependencies including the Scala module, and you just need to include it explicitly like this:

libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.12.1 or whatever version you have"
1 Like

The problem was that, thanks!