Liam Haworth
Liam Haworth

Reputation: 858

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

I am building a spray application in scala and I am following the example found 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 have lead me no where, here is the code for my application

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 post more code snipits if required

Thanks,

Liam

Upvotes: 3

Views: 1771

Answers (1)

mohit
mohit

Reputation: 4999

IO.apply takes an implicit ActorSystem. Either make actorSystem as implicit by using implicit var actorSytem or pass actorSystem explicitly as IO(Http)(actorSystem)

Upvotes: 4

Related Questions