我写了一个函数来通过spark流处理流。我遇到了 java.lang.NoSuchMethodError:org.json4s.jackson.JsonMethods $ .parse $ default $ 3()Z
我已经检查过spark版本(1.6.0)和scala版本(2.10.5)。它与json4s jar版本(json4s-jackson_2.10-3.3.0.jar)一致。我无法弄清楚发生了什么。以下是功能代码:
import org.json4s._
import org.json4s.jackson.Serialization.{read => JsonRead}
import org.json4s.jackson.JsonMethods._
def processStream(ssc: StreamingContext, windowStream: DStream[Array[Byte]], eventhubsId: Int): Unit = {
/*
...
*/
val successStream = eventsStream.filter(_.isSuccess).map(_.get)
val successEventDataWindowStream = successStream.map(x => {
val eventDataStr = x._2.getOrElse("")
implicit val formats = jackson.Serialization.formats(NoTypeHints)
Try(parse(eventDataStr).camelizeKeys.extract[EventData]) match {
case Success(eventData) => Success(eventData)
case Failure(ex) => Failure(ex)
}
})
}