gilbertw1 / akka-http-stream-example

An example program that uses the akka-http stream api
60 stars 18 forks source link

http example compile errors? #2

Open nacmacfeegle opened 9 years ago

nacmacfeegle commented 9 years ago

Great project + supporting blog post.

I'm trying to get the http example going and getting compile errors. Tried out of the box on 2 systems, each producing the errors below.

Any idea what might be wrong?

$ sbt akka-http-example/run
[info] Loading project definition from /private/tmp/akka-http-stream-example/project
[info] Set current project to akka-http-stream-example (in build file:/private/tmp/akka-http-stream-example/)
[warn] Scala version was updated by one of library dependencies:
[warn]  * org.scala-lang:scala-library:(2.11.2, 2.11.0, 2.11.1) -> 2.11.5
[warn] To force scalaVersion, add the following:
[warn]  ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }
[warn] Run 'evicted' to see detailed eviction warnings
[info] Compiling 6 Scala sources to /private/tmp/akka-http-stream-example/akka-http-example/target/scala-2.11/classes...
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/HttpClient.scala:25: inferred type arguments [akka.http.HttpExt] do not conform to method apply's type parameter bounds [T <: akka.io.IO.Extension]
[error]       val connFuture = IO(Http).ask(Http.Connect("127.0.0.1", port)).mapTo[Http.OutgoingConnection]
[error]                        ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/HttpClient.scala:25: type mismatch;
[error]  found   : akka.http.Http.type
[error]  required: akka.actor.ExtensionId[T]
[error]       val connFuture = IO(Http).ask(Http.Connect("127.0.0.1", port)).mapTo[Http.OutgoingConnection]
[error]                           ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/HttpClient.scala:25: value Connect is not a member of object akka.http.Http
[error]       val connFuture = IO(Http).ask(Http.Connect("127.0.0.1", port)).mapTo[Http.OutgoingConnection]
[error]                                          ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/HttpClient.scala:28: type mismatch;
[error]  found   : List[(akka.http.model.HttpRequest, Symbol)]
[error]  required: akka.stream.scaladsl.PartialFlowGraph
[error]       Flow(List(request -> 'NoContext)).produceTo(connection.processor)
[error]                ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/HttpServer.scala:19: inferred type arguments [akka.http.HttpExt] do not conform to method apply's type parameter bounds [T <: akka.io.IO.Extension]
[error]     val bindingFuture = IO(Http) ? Http.Bind(interface = "localhost", port = port)
[error]                         ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/HttpServer.scala:19: type mismatch;
[error]  found   : akka.http.Http.type
[error]  required: akka.actor.ExtensionId[T]
[error]     val bindingFuture = IO(Http) ? Http.Bind(interface = "localhost", port = port)
[error]                            ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/HttpServer.scala:19: value Bind is not a member of object akka.http.Http
[error]     val bindingFuture = IO(Http) ? Http.Bind(interface = "localhost", port = port)
[error]                                         ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/HttpServer.scala:19: not found: value interface
[error]     val bindingFuture = IO(Http) ? Http.Bind(interface = "localhost", port = port)
[error]                                              ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/HttpServer.scala:19: reassignment to val
[error]     val bindingFuture = IO(Http) ? Http.Bind(interface = "localhost", port = port)
[error]                                                                            ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/Main.scala:39: type mismatch;
[error]  found   : org.reactivestreams.Publisher[akka.http.model.HttpEntity.ChunkStreamPart]
[error]  required: akka.stream.scaladsl.Source[akka.http.model.HttpEntity.ChunkStreamPart]
[error]           entity = new Chunked(MediaTypes.`text/plain`, publisher)
[error]                                                         ^
[error] /private/tmp/akka-http-stream-example/akka-http-example/src/main/scala/StreamClientPublisher.scala:26: akka.stream.scaladsl.Source[akka.util.ByteString] does not take parameters
[error]       response.entity.dataBytes(materializer).subscribe(processorSubscriber)
[error]                                ^
[error] 11 errors found
[error] (akka-http-example/compile:compile) Compilation failed
[error] Total time: 2 s, completed 12-Feb-2015 09:56:44
jkuru commented 9 years ago

i had the same issue, was able to get past the issue by updating the version of these two lib in Build.Scala val akkaHttp = "com.typesafe.akka" %% "akka-http-core-experimental" % "0.7" val akkaStream = "com.typesafe.akka" %% "akka-stream-experimental" % "0.2"