ReactiveMongoModule 无法实例化

ReactiveMongoModule cannot be instantiated

不确定发生了什么,一切都编译正常,但是当我 运行 项目失败时。我在 build.sbt 中导入了 reactivemongo,并且在我的 application.conf 文件中启用了以下内容。我正在使用 play 2.5.10

play.modules.enabled += "play.modules.reactivemongo.ReactiveMongoModule"

这是错误:

Module [play.modules.reactivemongo.ReactiveMongoModule] cannot be instantiated.

java.lang.ClassNotFoundException: play.modules.reactivemongo.ReactiveMongoModule
 java.net.URLClassLoader.findClass(URLClassLoader.java:381)
 java.lang.ClassLoader.loadClass(ClassLoader.java:424)
 java.lang.ClassLoader.loadClass(ClassLoader.java:357)
 play.api.inject.Modules$$anonfun$locate$$anonfun$apply.apply(Module.scala:115)
 play.api.inject.Modules$$anonfun$locate$$anonfun$apply.apply(Module.scala:115)
 play.api.inject.Modules$.play$api$inject$Modules$$constructModule(Module.scala:121)
 play.api.inject.Modules$$anonfun$locate.apply(Module.scala:114)
 play.api.inject.Modules$$anonfun$locate.apply(Module.scala:113)
 scala.collection.TraversableLike$$anonfun$map.apply(TraversableLike.scala:245)
 scala.collection.TraversableLike$$anonfun$map.apply(TraversableLike.scala:245)
 scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:322)
 scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:978)
 scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
 scala.collection.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:47)
 scala.collection.SetLike$class.map(SetLike.scala:92)
 scala.collection.AbstractSet.map(Set.scala:47)
 play.api.inject.Modules$.locate(Module.scala:113)
 play.api.inject.guice.GuiceableModule$.loadModules(GuiceInjectorBuilder.scala:272)
 play.api.inject.guice.GuiceApplicationBuilder$$anonfun$$lessinit$greater$default.apply(GuiceApplicationBuilder.scala:30)
 play.api.inject.guice.GuiceApplicationBuilder$$anonfun$$lessinit$greater$default.apply(GuiceApplicationBuilder.scala:30)
 play.api.inject.guice.GuiceApplicationBuilder.applicationModule(GuiceApplicationBuilder.scala:109)
 play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
 play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
 play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
 play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply$$anonfun$$anonfun.apply(DevServerStart.scala:168)
 play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply$$anonfun$$anonfun.apply(DevServerStart.scala:164)
 play.utils.Threads$.withContextClassLoader(Threads.scala:21)
 play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply$$anonfun.apply(DevServerStart.scala:164)
 play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply$$anonfun.apply(DevServerStart.scala:131)
 scala.Option.map(Option.scala:146)
 play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply.apply(DevServerStart.scala:131)
 play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply.apply(DevServerStart.scala:129)
 scala.util.Success.flatMap(Try.scala:231)
 play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get.apply(DevServerStart.scala:129)
 play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get.apply(DevServerStart.scala:121)
 scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1(Future.scala:24)
 scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
 java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
 java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
 java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
 java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
 java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

可能的问题:您添加了反应式 mongo 本身而不是反应式 mongo 播放模块。检查 build.sbt,它必须看起来像:

libraryDependencies += "org.reactivemongo" %% "play2-reactivemongo" % "0.12.0"