2
votes

I'm using akka-http and reactivemongo in my project and marshalling/unmarshalling case classes with akka-http-spray-json. Here are their dependencies -

"com.typesafe.akka" %% "akka-http" % "10.1.3"
"com.typesafe.akka" %% "akka-stream" % "2.5.14"
"com.typesafe.akka" %% "akka-http-spray-json" % "10.1.3"
"org.reactivemongo" %% "reactivemongo" % "0.16.0"

My code is working fine in another project where I've not used reactivemongo. But now I'm getting error -

[error] /home/ficode/project/ficode-sentinll/sentinll-common/src/main/scala/ficode/sentinll/common/model/CategoryManagement.scala:32:69: Symbol 'term akka.stream' is missing from the classpath.
[error] This symbol is required by 'method akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport.sprayJsonSourceReader'.
[error] Make sure that term stream is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'SprayJsonSupport.class' was compiled against an incompatible version of akka.
[error]   implicit val requestHeaderFormat = jsonFormat1(RequestHeader)
[error]                                                                     ^
[error] one error found

I was also getting warnings regarding version conflicts in reactivemongo and akka-stream -

[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]  * com.typesafe.akka:akka-actor_2.11:2.5.14 is selected over 2.3.13
[warn]      +- com.typesafe.akka:akka-stream_2.11:2.5.14 ()       (depends on 2.5.14)
[warn]      +- org.reactivemongo:reactivemongo_2.11:0.16.0 ()     (depends on 2.3.13)
[warn] Run 'evicted' to see detailed eviction warnings

I tried to exclude akka dependencies from reactivemongo. The warnings went away but not the error.

Any idea how can I resolve it ? Thanks in advance.

1
ReactiveMongo is compatible with akka from 2.3 up to 2.5 (covered by tests), so about that the warning denotes no issue (just indicated the minimal version is overriden by a later one, which is supported). - cchantep

1 Answers

1
votes

Try to add override in SBT?

dependencyOverrides ++= Set("com.typesafe.akka" % "akka-http-spray-json" % "10.1.3")