Salat Error: class file needed by SalatDAO is missing. reference type MongoCollection of com.mongodb.casbah.TypeImports refers to nonexisting symbol

StackOverflow https://stackoverflow.com/questions/9991125

  •  28-05-2021
  •  | 
  •  

Frage

I'm getting the following error when I try to extend SalatDAO or use grater[T].asObject(x):

class file needed by SalatDAO is missing. reference type MongoCollection of com.mongodb.casbah.TypeImports refers to nonexisting symbol.

I've followed the Salat examples but, for some reason, extending SalatDAO and graters asObject do not work for me. I cannot find any reference to this error online.

Here's my code:

import net.trevor.model.DBConnection._
import com.novus.salat._
import com.novus.salat.global._
import com.mongodb.casbah.Imports._
import com.novus.salat.dao.SalatDAO

//error occurs on following line:
object HandleDAO extends SalatDAO[Handle, ObjectId](DBConnection.db("Handles")){

      def getHandleAsDBObject(handle : Handle) : DBObject = 
         grater[Handle].asDBObject(handle)

      def getHandleFromDBObject(dbObject : DBObject) : Handle =
         //error occurs on following line: 
         grater[Handle].asObject(dbObject)  
 }

I'd really appreciate any help or advice on this. I'm new to Scala and Mongodb.

I'm compiling using sbt compile. Here's my build.sbt

name := "handle_engine"

version := "1.0"

scalaVersion := "2.9.1"

scalacOptions += "-deprecation"

fork in run := true


resolvers ++= Seq(
    "twitter-repo" at "http://maven.twttr.com",
    "repo.novus rels" at "http://repo.novus.com/releases/",
    "repo.novus snaps" at "http://repo.novus.com/snapshots/",
    "Java.net Maven2 Repository" at "http://download.java.net/maven/2/"
) 


libraryDependencies ++= {
  val liftVersion = "2.4-M5" // Put the current/latest lift version here
  Seq(
    "net.liftweb" %% "lift-webkit" % liftVersion % "compile->default",
    "net.liftweb" %% "lift-mapper" % liftVersion % "compile->default",
    "net.liftweb" %% "lift-amqp" % liftVersion % "compile->default",
    "net.liftweb" %% "lift-mongodb" % liftVersion % "compile->default",
    "net.liftweb" %% "lift-mongodb-record" % liftVersion % "compile->default",
    "net.liftweb" %% "lift-wizard" % liftVersion % "compile->default")
}



libraryDependencies ++= Seq( 
  "org.eclipse.jetty" % "jetty-server" % "8.1.0.RC5", // % "compile,jetty",
  "org.eclipse.jetty" % "jetty-servlet" % "8.1.0.RC5", // % "compile,jetty",
  "org.mongodb" % "mongo-java-driver" % "compile->default",
  "com.rabbitmq" % "amqp-client" % "compile->default",
  "org.mongodb" % "casbah_2.9.0-1" % "3.0.0-M2",
  "com.novus" % "salat-core_2.8.1" % "0.0.7",    //Salat for MongoDB and Casbah
  "org.apache.avro" % "avro" % "1.6.2",
  "com.twitter" % "util-core_2.9.1" % "1.12.8", "com.twitter" % "util-eval_2.9.1" %   "1.12.8",
  "junit" % "junit" % "4.5" % "test->default",
  "javax.servlet" % "servlet-api" % "2.5" % "provided->default",
  "ch.qos.logback" % "logback-classic" % "0.9.26" % "compile->default"
)

seq(webSettings :_*)

libraryDependencies += "org.mortbay.jetty" % "jetty" % "6.1.26" % "test,container"

libraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.9" % "test"
War es hilfreich?

Lösung

It looks like you might be on an older version of Salat. Try changing you version to following:

"com.novus" %% "salat-core" % "0.0.8-SNAPSHOT"

or

"com.novus" % "salat-core_2.9.1" % "0.0.8-SNAPSHOT"

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top