Scala + Lift + MongoDB = NoClassDefFoundError错误

时间:2013-10-21 14:07:55

标签: scala noclassdeffounderror

我是Scala和Lift的新手。试图创建简单的休息服务。

这是我的用户对象:

object User extends MongoDocumentMeta[User]{
  override def collectionName = "users"
  override def formats = super.formats + new ObjectIdSerializer + new DateSerializer
}

case class User(_id: ObjectId, login: String, email: String, password: String, created: Date) extends MongoDocument[User] {
  def meta = User
}

这是一项休息服务:

object users extends RestHelper {
  serve {
    case "users" :: Nil JsonGet _ => Extraction.decompose(User.findAll)
    case "users" :: userId :: Nil JsonGet _ => Extraction.decompose(User.find(userId))
  }
}

GET http://localhost:8080/users请求它返回

访问/用户时出现问题。原因是:

scala/reflect/Manifest$

引起:

  

java.lang.NoClassDefFoundError:scala / reflect / Manifest $       at net.liftweb.mongodb.JObjectParser $$ anon $ 1.(JObjectParser.scala:39)       at net.liftweb.mongodb.JObjectParser $。(JObjectParser.scala:39)       at net.liftweb.mongodb.JObjectParser $。(JObjectParser.scala)       at net.liftweb.mongodb.MongoDocumentMeta $ class.create(MongoDocument.scala:55)       at code.model.User $ .create(User.scala:16)       在net.liftweb.mongodb.MongoDocumentMeta $$ anonfun $ findAll $ 1 $$ anonfun $ apply $ 1.apply(MongoDocument.scala:111)       在net.liftweb.mongodb.MongoDocumentMeta $$ anonfun $ findAll $ 1 $$ anonfun $ apply $ 1.apply(MongoDocument.scala:111)       在scala.collection.Iterator $$ anon $ 11.next(Iterator.scala:328)       在scala.collection.Iterator $ class.foreach(Iterator.scala:727)       在scala.collection.AbstractIterator.foreach(Iterator.scala:1156)

     

...

我犯了错误?

0 个答案:

没有答案