serialization - jackson-module-scala (play): registerModule(DefaultScalaModule): found DefaultScalaModule.type; required: databind.Module -
i trying un/marshall json in play app, using jackson-module-scala , example:
val mapper = new objectmapper() mapper.registermodule(defaultscalamodule)
i included these libraries in build.scala
"com.fasterxml" % "jackson-module-scala" % "1.9.3", "com.fasterxml.jackson.core" % "jackson-databind" % "2.3.0",
and imported:
import com.fasterxml.jackson.databind.objectmapper import com.fasterxml.jackson.module.scala.defaultscalamodule
however, when run play app, following error:
[error] found : com.fasterxml.jackson.module.scala.defaultscalamodule.type [error] required: com.fasterxml.jackson.databind.module [error] mapper.registermodule(defaultscalamodule) play.playexceptions$compilationexception: compilation error[type mismatch; found : com.fasterxml.jackson.module.scala.defaultscalamodule.type required: com.fasterxml.jackson.databind.module] @ play.playreloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(playreloader.scala:304) ~[na:na] @ play.playreloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(playreloader.scala:304) ~[na:na] @ scala.option.map(option.scala:145) ~[scala-library-2.10.3.jar:na] @ play.playreloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(playreloader.scala:304) ~[na:na] @ play.playreloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(playreloader.scala:298) ~[na:na] @ scala.option.map(option.scala:145) ~[scala-library-2.10.3.jar:na]
any appreciated.
was able figure out.
i trying latest version of jackson-module-scala
; latest version seemed 1.9.3
checking: http://mvnrepository.com/artifact/com.fasterxml/jackson-module-scala
however proper place had proper newest version 2.3.0
: http://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-scala_2.10
it fixed changing build.scala
to:
... "com.fasterxml" % "jackson-module-scala_2.10" % "2.3.0", "com.fasterxml.jackson.core" % "jackson-databind" % "2.3.0", ...
or better use "%%" (for automatic scala version resolution; don't need add "_scala.ver"):
... "com.fasterxml" %% "jackson-module-scala" % "2.3.0", "com.fasterxml.jackson.core" % "jackson-databind" % "2.3.0", ...
Comments
Post a Comment