gpt4 book ai didi

scala - play 2.3/reactivemongo 应用程序上的编译器错误

转载 作者:行者123 更新时间:2023-12-02 10:44:34 26 4
gpt4 key购买 nike

我正在使用 reactivemongo 驱动程序在 Scala 中编写 Play 2.3.2 应用程序。
我有一个使用其他模块的主应用程序。
星期五我的应用程序正确编译和执行。
现在我遇到了一些问题,但我没有更改任何代码。

这是我的 build.sbt 文件:

name := "recommendation-system"

version := "1.2-BETA"

scalaVersion := "2.11.1"

resolvers += Resolver.sonatypeRepo("snapshots")

libraryDependencies ++= Seq(
ws,
jdbc,
anorm,
cache,
"org.reactivemongo" %% "play2-reactivemongo" % "0.11.0-SNAPSHOT"
)

javaOptions in Test += "-Dconfig.file=conf/test.conf"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

这是我的编译器错误:
[error] bad symbolic reference to reactivemongo.api.collections.GenericHandlers encountered in class file 'JSONGenericHandlers.class'.
[error] Cannot access type GenericHandlers in package reactivemongo.api.collections. The current classpath may be
[error] missing a definition for reactivemongo.api.collections.GenericHandlers, or JSONGenericHandlers.class may have been compiled against a version that's
[error] incompatible with the one found on the current classpath.
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:25: type arguments [play.modules.reactivemongo.json.collection.JSONCollection] do not conform to method collection's type parameter bounds [C <: reactivemongo.api.Collection]
[error] def collection: JSONCollection = db.collection[JSONCollection](collectionName)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:29: wrong number of type arguments for reactivemongo.api.collections.GenericQueryBuilder, should be 1
[error] case class MyQueryBuilder(gqb: GenericQueryBuilder[JsObject, Reads, Writes]) {
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:94: type mismatch;
[error] found : reactivemongo.core.commands.GetLastError
[error] required: reactivemongo.api.commands.WriteConcern
[error] (which expands to) reactivemongo.api.commands.GetLastError
[error] Error occurred in an application involving default arguments.
[error] if (upsert) collection.update(e, e, GetLastError(), upsert)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:95: could not find implicit value for parameter writer: GenericCollection.this.pack.Writer[T]
[error] Error occurred in an application involving default arguments.
[error] else collection.insert(e)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:103: type mismatch;
[error] found : reactivemongo.core.commands.GetLastError
[error] required: reactivemongo.api.commands.WriteConcern
[error] (which expands to) reactivemongo.api.commands.GetLastError
[error] Error occurred in an application involving default arguments.
[error] collection.update(query, Json.obj("$set" -> e), GetLastError())
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:111: type mismatch;
[error] found : reactivemongo.core.commands.GetLastError
[error] required: reactivemongo.api.commands.WriteConcern
[error] (which expands to) reactivemongo.api.commands.GetLastError
[error] Error occurred in an application involving default arguments.
[error] collection.update(query, e, GetLastError(), upsert)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:119: type mismatch;
[error] found : reactivemongo.core.commands.GetLastError
[error] required: reactivemongo.api.commands.WriteConcern
[error] (which expands to) reactivemongo.api.commands.GetLastError
[error] Error occurred in an application involving default arguments.
[error] collection.update(query, e, GetLastError(), upsert)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:127: could not find implicit value for parameter writer: GenericCollection.this.pack.Writer[T]
[error] Error occurred in an application involving default arguments.
[error] collection.remove(e)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:135: could not find implicit value for parameter swriter: GenericCollection.this.pack.Writer[play.api.libs.json.JsObject]
[error] MyQueryBuilder(collection.find(Json.obj()))
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:142: could not find implicit value for parameter swriter: GenericCollection.this.pack.Writer[play.api.libs.json.JsValue]
[error] MyQueryBuilder(collection.find(selector))
[error] ^
[error] 11 errors found
[error] bad symbolic reference to reactivemongo.api.collections.GenericHandlers encountered in class file 'JSONGenericHandlers.class'.
[error] Cannot access type GenericHandlers in package reactivemongo.api.collections. The current classpath may be
[error] missing a definition for reactivemongo.api.collections.GenericHandlers, or JSONGenericHandlers.class may have been compiled against a version that's
[error] incompatible with the one found on the current classpath.
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:25: type arguments [play.modules.reactivemongo.json.collection.JSONCollection] do not conform to method collection's type parameter bounds [C <: reactivemongo.api.Collection]
[error] def collection: JSONCollection = db.collection[JSONCollection](collectionName)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:29: wrong number of type arguments for reactivemongo.api.collections.GenericQueryBuilder, should be 1
[error] case class MyQueryBuilder(gqb: GenericQueryBuilder[JsObject, Reads, Writes]) {
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:94: type mismatch;
[error] found : reactivemongo.core.commands.GetLastError
[error] required: reactivemongo.api.commands.WriteConcern
[error] (which expands to) reactivemongo.api.commands.GetLastError
[error] Error occurred in an application involving default arguments.
[error] if (upsert) collection.update(e, e, GetLastError(), upsert)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:95: could not find implicit value for parameter writer: GenericCollection.this.pack.Writer[T]
[error] Error occurred in an application involving default arguments.
[error] else collection.insert(e)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:103: type mismatch;
[error] found : reactivemongo.core.commands.GetLastError
[error] required: reactivemongo.api.commands.WriteConcern
[error] (which expands to) reactivemongo.api.commands.GetLastError
[error] Error occurred in an application involving default arguments.
[error] collection.update(query, Json.obj("$set" -> e), GetLastError())
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:111: type mismatch;
[error] found : reactivemongo.core.commands.GetLastError
[error] required: reactivemongo.api.commands.WriteConcern
[error] (which expands to) reactivemongo.api.commands.GetLastError
[error] Error occurred in an application involving default arguments.
[error] collection.update(query, e, GetLastError(), upsert)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:119: type mismatch;
[error] found : reactivemongo.core.commands.GetLastError
[error] required: reactivemongo.api.commands.WriteConcern
[error] (which expands to) reactivemongo.api.commands.GetLastError
[error] Error occurred in an application involving default arguments.
[error] collection.update(query, e, GetLastError(), upsert)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:127: could not find implicit value for parameter writer: GenericCollection.this.pack.Writer[T]
[error] Error occurred in an application involving default arguments.
[error] collection.remove(e)
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:135: could not find implicit value for parameter swriter: GenericCollection.this.pack.Writer[play.api.libs.json.JsObject]
[error] MyQueryBuilder(collection.find(Json.obj()))
[error] ^
[error] /Users/alberto/git/bdrim/modules/recommendation-system/app/recommendationsystem/models/storage/MongoObj.scala:142: could not find implicit value for parameter swriter: GenericCollection.this.pack.Writer[play.api.libs.json.JsValue]
[error] MyQueryBuilder(collection.find(selector))
[error] ^
[info] No documentation generated with unsuccessful compiler run
[warn] three warnings found
[error] 11 errors found
[error] (compile:doc) Scaladoc generation failed
[error] (compile:compile) Compilation failed
[error] Total time: 30 s, completed 13-ott-2014 11.44.28
make: *** [publish-all] Error 1

这里是编译器给我错误的文件:
package recommendationsystem.models.storage

import scala.concurrent.{ ExecutionContext, Future }

// Reactive Mongo imports
import reactivemongo.api._
import reactivemongo.api.collections._
import reactivemongo.core.commands._

// Play Json imports
import play.modules.reactivemongo._
import play.modules.reactivemongo.json.collection.JSONCollection
import play.modules.reactivemongo.ReactiveMongoPlugin
import play.api.libs.iteratee.Enumerator
import play.api.libs.json._

import play.api.Play.current

trait MongoObj[T] {
def collectionName: String
implicit val ec: ExecutionContext = ExecutionContext.Implicits.global
/** Switch to implicit lazy val on production */
implicit def db = ReactiveMongoPlugin.db
/** Switch to implicit val on production */
def collection: JSONCollection = db.collection[JSONCollection](collectionName)
/** storage formatter */
implicit val storageFormat: Format[T]

case class MyQueryBuilder(gqb: GenericQueryBuilder[JsObject, Reads, Writes]) {

def sort(by: JsObject): MyQueryBuilder = {
MyQueryBuilder(gqb.sort(by))
}

/**
* Skip first s element
* @param s number of element to skip
* Implicit T -> JsObject must be in scope
*/
def skip(s: Int): MyQueryBuilder = {
MyQueryBuilder(gqb.options(QueryOpts(s)))
}

/**
* Take only l element
* @param l number of element to take
* Implicit T -> JsObject must be in scope
*/
def limit(l: Int): MyQueryBuilder = {
val opt = gqb.options
MyQueryBuilder(gqb.options(opt.batchSize(l)))
//collection.find(Json.obj()).sort(sortBy).options(QueryOpts(skip, limit)).cursor[T].collect[List](limit)
}

/**
* Return list of all result elements
* Implicit T -> JsObject must be in scope
*/
def toList(implicit read: Reads[T]): Future[List[T]] = {
if (gqb.options.batchSizeN > 0)
gqb.cursor[T].collect[List](gqb.options.batchSizeN)
else
gqb.cursor[T].collect[List](100000)
}

/**
* Return an enumerator of all elements
* Implicit T -> JsObject must be in scope
*/
def toEnum(implicit read: Reads[T]): Enumerator[T] = {
gqb.cursor[T].enumerate()
}

/**
* skip parameter
* Implicit T -> JsObject must be in scope
*/
def one(implicit read: Reads[T]): Future[Option[T]] = {
gqb.one[T]
}

}

/**
* Return number of all documents on collection
*/
def count: Future[Int] = collection.db.command(Count(collection.name))

/**
* Insert an element to collection,
* Implicit T -> JsObject must be in scope
*/
def save(e: T, upsert: Boolean = false): Future[LastError] = {
if (upsert) collection.update(e, e, GetLastError(), upsert)
else collection.insert(e)
}

/**
* Update an element to collection with parameter e, the element to update is selected by parameter query
* Implicit T -> JsObject must be in scope
*/
def update(query: JsObject, e: JsObject): Future[LastError] = {
collection.update(query, Json.obj("$set" -> e), GetLastError())
}

/**
* Update an element to collection with parameter e, the element to update is selected by parameter query
* Implicit T -> JsObject must be in scope
*/
def update(query: T, e: T, upsert: Boolean): Future[LastError] = {
collection.update(query, e, GetLastError(), upsert)
}

/**
* Update an element to collection with parameter e, the element to update is selected by parameter query
* Implicit T -> JsObject must be in scope
*/
def update(query: JsObject, e: T, upsert: Boolean = false): Future[LastError] = {
collection.update(query, e, GetLastError(), upsert)
}

/**
* Remove an element from collection,
* Implicit T -> JsObject must be in scope
*/
def remove(e: T): Future[LastError] = {
collection.remove(e)
}

/**
* Return all element in collection
* Implicit T -> JsObject must be in scope
*/
def all(implicit tformat: Format[T]): MyQueryBuilder =
MyQueryBuilder(collection.find(Json.obj()))

/**
* Find elements in collection, sorted by sortBy parameter
* Implicit T -> JsObject must be in scope
*/
def find(selector: JsValue)(implicit tformat: Format[T]): MyQueryBuilder = {
MyQueryBuilder(collection.find(selector))
}

}

之后我尝试更新我的 build.sbt 文件如下:
name := "recommendation-system"

version := "1.2-BETA"

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
ws,
jdbc,
anorm,
cache,
"org.reactivemongo" %% "play2-reactivemongo" % "0.10.5.0.akka23"
)

javaOptions in Test += "-Dconfig.file=conf/test.conf"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

现在我的项目编译,但我得到以下运行时错误:
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/alberto/.ivy2/cache/org.slf4j/slf4j-nop/jars/slf4j-nop-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/alberto/.ivy2/cache/org.slf4j/slf4j-jdk14/jars/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/alberto/.ivy2/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.helpers.NOPLoggerFactory]
[info] application - ReactiveMongoPlugin starting...
[info] application - ReactiveMongoPlugin successfully started with db 'bdrim'! Servers:
[localhost:27017]
[info] application - Application has started
[info] play - Starting application default Akka system.
Uncaught error from thread [play-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[play]
java.lang.NoClassDefFoundError: reactivemongo/api/collections/GenericHandlers
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)[ERROR] [10/13/2014 11:23:57.603] [play-akka.actor.default-dispatcher-2] [ActorSystem(play)] Uncaught error from thread [play-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
java.lang.NoClassDefFoundError: reactivemongo/api/collections/GenericHandlers
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at play.modules.reactivemongo.json.collection.package$JSONCollectionProducer$.apply(jsoncollection.scala:31)
at play.modules.reactivemongo.json.collection.package$JSONCollectionProducer$.apply(jsoncollection.scala:30)
at reactivemongo.api.DB$class.collection(database.scala:64)
at reactivemongo.api.DefaultDB.collection(database.scala:163)
at recommendationsystem.models.storage.MongoObj$class.collection(MongoObj.scala:25)
at recommendationsystem.algorithms.Similarity$.collection(Pearson.scala:52)
at recommendationsystem.algorithms.Pearson$.mapReduce(Pearson.scala:203)
at recommendationsystem.algorithms.Pearson$.calculate(Pearson.scala:217)
at Settings$$anonfun$onStart$1.apply$mcV$sp(Settings.scala:26)
at akka.actor.Scheduler$$anon$5.run(Scheduler.scala:79)
at akka.actor.LightArrayRevolverScheduler$$anon$2$$anon$1.run(Scheduler.scala:242)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(F
orkJoinWorkerThread.java:107)
Caused by: java.lang.ClassNotFoundException: reactivemongo.api.collections.GenericHandlers
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 39 more

at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at play.modules.reactivemongo.json.collection.package$JSONCollectionProducer$.apply(jsoncollection.scala:31)
at play.modules.reactivemongo.json.collection.package$JSONCollectionProducer$.apply(jsoncollection.scala:30)
at reactivemongo.api.DB$class.collection(database.scala:64)
at reactivemongo.api.DefaultDB.collection(database.scala:163)
at recommendationsystem.models.storage.MongoObj$class.collection(MongoObj.scala:25)
at recommendationsystem.algorithms.Similarity$.collection(Pearson.scala:52)
at recommendationsystem.algorithms.Pearson$.mapReduce(Pearson.scala:203)
at recommendationsystem.algorithms.Pearson$.calculate(Pearson.scala:217)
at Settings$$anonfun$onStart$1.apply$mcV$sp(Settings.scala:26)
at akka.actor.Scheduler$$anon$5.run(Scheduler.scala:79)
at akka.actor.LightArrayRevolverScheduler$$anon$2$$anon$1.run(Scheduler.scala:242)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.ClassNotFoundException: reactivemongo.api.collections.GenericHandlers
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 39 more
[error] a.a.ActorSystemImpl - Uncaught error from thread [play-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
java.lang.NoClassDefFoundError: reactivemongo/api/collections/GenericHandlers
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_55]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[na:1.7.0_55]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.7.0_55]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[na:1.7.0_55]
at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[na:1.7.0_55]
Caused by: java.lang.ClassNotFoundException: reactivemongo.api.collections.GenericHandlers
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_55]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_55]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_55]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_55]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[na:1.7.0_55]
Uncaught error from thread [[ERROR] [10/13/2014 11:23:57.640] [application-akka.actor.default-dispatcher-2] [ActorSystem(application)] Uncaught error from thread [application-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
java.lang.AbstractMethodError: org.apache.logging.slf4j.SLF4JLoggerContextFactory.getContext(Ljava/lang/String;Ljava/lang/ClassLoader;Ljava/lang/Object;Z)Lorg/apache/logging/log4j/spi/LoggerContext;
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:474)
at reactivemongo.utils.LazyLogger$.apply(utils.scala:55)
at reactivemongo.core.actors.MongoDBSystem$.<init>(actors.scala:670)
at reactivemongo.core.actors.MongoDBSystem$.<clinit>(actors.scala)
at reactivemongo.api.MongoDriver$$anonfun$7.apply(api.scala:511)
at reactivemongo.api.MongoDriver$$anonfun$7.apply(api.scala:511)
at akka.actor.TypedCreatorFunctionConsumer.produce(Props.scala:343)
at akka.actor.Props.newActor(Props.scala:252)
at akka.actor.ActorCell.newActor(ActorCell.scala:552)
at akka.actor.ActorCell.create(ActorCell.scala:578)
at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:456)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263)
at akka.dispatch.Mailbox.run(Mailbox.scala:219)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

application-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application]
java.lang.AbstractMethodError: org.apache.logging.slf4j.SLF4JLoggerContextFactory.getContext(Ljava/lang/String;Ljava/lang/ClassLoader;Ljava/lang/Object;Z)Lorg/apache/logging/log4j/spi/LoggerContext;
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:474)
at reactivemongo.utils.LazyLogger$.apply(utils.scala:55)
at reactivemongo.core.actors.MongoDBSystem$.<init>(actors.scala:670)
at reactivemongo.core.actors.MongoDBSystem$.<clinit>(actors.scala)
at reactivemongo.api.MongoDriver$$anonfun$7.apply(api.scala:511)
at reactivemongo.api.MongoDriver$$anonfun$7.apply(api.scala:511)

我认为 reactivemongo 或 akka 最近已经更新,没有更改项目的版本。

怎么了??

最佳答案

最后我解决了以下问题:

  • 删除$HOME/.ivy2/cache folder中的所有文件
  • 将built.sbt 更改如下:

    名称:=“推荐系统”

    版本:=“1.2-BETA”

    scalaVersion := "2.11.1"

    libraryDependencies++= Seq(
    ws,
    数据库,
    异常,
    缓存,
    “org.reactivemongo”%%“play2-reactivemongo”%“0.10.5.0.akka23”
    )

    测试中的 javaOptions += "-Dconfig.file=conf/test.conf"

    lazy val root = (文件中的项目(".")).enablePlugins(PlayScala)
  • activator clean之前 run .
  • 关于scala - play 2.3/reactivemongo 应用程序上的编译器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26337173/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com