Reference: a test case from the official documentation. Currently, I use 3.5 json4s
object JsonLoader {
def parseJsonConfig[T: Manifest](filename: String): T = {
implicit lazy val formats: DefaultFormats = new DefaultFormats {
override val strictOptionParsing: Boolean = true
}
val inputStream = getClass.getResourceAsStream(filename)
val lines = try {
Source.fromInputStream(new BufferedInputStream(inputStream)).getLines.mkString
} catch {
case _: Exception => throw new Exception("config file not found")
}
parse(lines, useBigDecimalForDouble = false).extract[T]
}
}
Exception in thread "main" java.lang.AbstractMethodError
at org.json4s.DefaultFormats$class.$init$(Formats.scala:329)
at jp.co.yahoo.k2.i2i.optimizer.util.JsonLoader$$anon$1.<init>(JsonLoader.scala:16)
at jp.co.yahoo.k2.i2i.optimizer.util.JsonLoader$.parseJsonConfig(JsonLoader.scala:16)
Some people encountered the same problem, but they were referencing previous versions. Any thoughts and advice are appreciated.