不确定发生了什么,一切都编译得很好,但是当我运行项目时它失败了。我在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$1$$anonfun$apply$1.apply(Module.scala:115)
play.api.inject.Modules$$anonfun$locate$1$$anonfun$apply$1.apply(Module.scala:115)
play.api.inject.Modules$.play$api$inject$Modules$$constructModule(Module.scala:121)
play.api.inject.Modules$$anonfun$locate$1.apply(Module.scala:114)
play.api.inject.Modules$$anonfun$locate$1.apply(Module.scala:113)
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
scala.collection.TraversableLike$$anonfun$map$1.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$10$1.apply(GuiceApplicationBuilder.scala:30)
play.api.inject.guice.GuiceApplicationBuilder$$anonfun$$lessinit$greater$default$10$1.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$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
play.utils.Threads$.withContextClassLoader(Threads.scala:21)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:164)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:131)
scala.Option.map(Option.scala:146)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:131)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:129)
scala.util.Success.flatMap(Try.scala:231)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:129)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:121)
scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(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)
答案 0 :(得分:3)
可能的问题:你添加了反应性mongo本身,但没有添加反应性mongo游戏模块。检查build.sbt
,它必须如下所示:
libraryDependencies += "org.reactivemongo" %% "play2-reactivemongo" % "0.12.0"