IO (Http) is causing the error "could not find implicit value for parameter system: akka.actor.ActorSystem"

I am creating a spray application in scala and I am following the example here but when I go to compile I get this error

Error:(38, 7) could not find implicit value for parameter system: akka.actor.ActorSystem
                IO(Http) ! Http.Bind(webServer,
                  ^

      

And google search didn't get me there, here is the code for my app

package au.net.hivemedia.polydeploy

import akka.actor.{Props, ActorRef, ActorSystem}
import akka.io.IO
import au.net.hivemedia.polydeploy.dono.http.WebServerActor
import spray.can.Http

/**
 * PolyDeploy Dono - Braeburn
 *
 * Copyright (c) Hive Media Production, 2014.
 * All rights reserved. Do not redistribute
 *
 */
object App extends App {

  final val VERSION = "1.0-SNAPSHOT"
  final val CODENAME = "Twilight Sparkle"

  private var instance: Dono = _
  private var actorSystem: ActorSystem = _
  private var webServer: ActorRef = _

  override def main(args: Array[String]) {
    println("Starting PolyDeploy Dono v" + VERSION)
    println("=+ Project Version Codename: " + CODENAME)

    instance = new Dono()
    println("=+ Loading required items into the runtime")
    instance.load()

    println("=+ Loading new Actor System")
    actorSystem = ActorSystem("DonoActorSystem")

    println("=+ Starting web interface server")
    webServer = actorSystem.actorOf(Props[WebServerActor], name = "WebServer")

    IO(Http) ! Http.Bind(webServer,
                         interface = instance.getConfiguration().getString("web-bind-host"),
                         port = instance.getConfiguration().getInt("web-bind-port"))

  }
}

      

I can send more snipits of code if required

Thank,

Liam

+3


source to share


1 answer


IO.apply

takes implicit ActorSystem

. Either make it ActorSystem

implicit using implicit var actorSytem

, or pass ActorSystem

explicitly asIO(Http)(actorSystem)



+4


source







All Articles