Reputation: 3009
I'm working on a back-end project using Scala, the Play Framework, and the IntelliJ IDE just to practice, I'm new to these technologies.
I added the Reactive Mongo dependency to the build.sbt
libraryDependencies ++= Seq(
"org.reactivemongo" %% "play2-reactivemongo" % "0.12.6-play26"
)
What I get is this error :
No implementation for play.modules.reactivemongo.ReactiveMongoApi was bound
When I hover the mouse on
"org.reactivemongo" %% "play2-reactivemongo" % "0.12.6-play26"
This little text displays:
Unknown artifact. Not resolved or indexed.
What am I doing wrong ?
UPDATE:
When i refresh the project by hitting option + enter on the dependency, the "Event log" shows this :
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible: [warn] * com.google.guava:guava:22.0 is selected over 19.0 [warn] +- com.typesafe.play:play_2.12:2.6.7 (depends on 22.0) [warn] +- com.google.inject:guice:4.1.0 (depends on 19.0) [warn] * com.typesafe.akka:akka-stream_2.12:2.5.6 is selected over 2.4.19 [warn] +- com.typesafe.play:play-streams_2.12:2.6.7 (depends on 2.5.6) [warn] +- com.typesafe.akka:akka-http-core_2.12:10.0.10 (depends on 2.4.19) [warn] * com.typesafe.akka:akka-actor_2.12:2.5.6 is selected over {2.4.14, 2.4.19} [warn] +- com.typesafe.akka:akka-stream_2.12:2.5.6 () (depends on 2.5.6) [warn] +- com.typesafe.play:play_2.12:2.6.7 (depends on 2.5.6) [warn] +- com.typesafe.akka:akka-slf4j_2.12:2.5.6 () (depends on 2.5.6) [warn] +- com.typesafe.akka:akka-parsing_2.12:10.0.10 (depends on 2.4.19) [warn] +- org.reactivemongo:reactivemongo_2.12:0.12.6 () (depends on 2.4.14) [warn] Run 'evicted' to see detailed eviction warnings
Upvotes: 0
Views: 1393
Reputation: 3157
First be sure you add this to you build.sbt:
routesGenerator := InjectedRoutesGenerator
Without this the controller is static and not going to dependency injection. Then I had the same issue as you and it was because of a bad configuration on application.conf. I feel when the config is not good there is a silence error when trying to create the mongo API instance and then is also not able to inject into the controller.
Upvotes: 0
Reputation: 19527
There is no 0.12.6-play26
version of the plugin published in the Maven Central Repository. You probably want version 0.12.7-play26
:
libraryDependencies ++= Seq(
"org.reactivemongo" %% "play2-reactivemongo" % "0.12.7-play26"
)
Upvotes: 2
Reputation: 23798
This looks like error from dependency injection. Have you followed the tutorial you referenced fully including the "Setup" part?
Thus, the dependency injection can be configured, so that the your controllers are given the new ReactiveMongo API. First, Add the line bellow to application.conf:
play.modules.enabled += "play.modules.reactivemongo.ReactiveMongoModule"
Upvotes: 2