Search code examples
jsonscalaplayframework-2.0jerkson

play, scala and jerkson noClassDefFound error


I am trying to work with jerkson in play and with scala 2.10. However, i want to load data fixtures based on a json files. for this prcoedure I'm trying to load the json with the "parse" command from jerkson. That ultimatly fails.

I'm doing this in the "override def onStart(app: Application)" function. The error:

NoClassDefFoundError: Could not initialize class com.codahale.jerkson.Json$

Any guesses why this is happening ? I have the following libs in my deps.:

"com.codahale" % "jerkson_2.9.1" % "0.5.0",
"com.cloudphysics" % "jerkson_2.10" % "0.6.3"

my parsing command is:

com.codahale.jerkson.Json.parse[Map[String,Any]](json)

Thanks in advance


Solution

  • A NoClassDefFoundError generally means there is some sort of issues with the classpath. For starters, if you are running on scala 2.10, I would remove the following line from your sbt file:

    "com.codahale" % "jerkson_2.9.1" % "0.5.0"
    

    Then, make sure the com.cloudphysics jerkson jar file is available in your apps classpath and try your test again.