Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

scala

akka

spray

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

like image 730
Liam Haworth Avatar asked Jan 18 '26 02:01

Liam Haworth


1 Answers

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

like image 66
mohit Avatar answered Jan 19 '26 18:01

mohit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!