Could not initialize class net.liftweb.json.DefaultFormats$

user10360768 Source

I am working in Scala programming language and I am trying to generate json from a case class.

I am following instructions on this page. I have added dependency in pom.xml


The code that I have in my worksheet is

import net.liftweb.json._
import net.liftweb.json.Serialization.write

case class Person(name: String, address: Address)
case class Address(city: String, state: String)

val p = Person("Alvin Alexander", Address("Talkeetna", "AK"))
implicit val formats = DefaultFormats
val jsonString = write(p)

I get exception: "java.lang.NoClassDefFoundError: Could not initialize class net.liftweb.json.DefaultFormats$"

what could be wrong here?




comments powered by Disqus