簡體   English   中英

IO(Http)導致錯誤“無法找到參數系統的隱式值:akka.actor.ActorSystem”

[英]IO(Http) is cause the error “could not find implicit value for parameter system: akka.actor.ActorSystem”

我在scala中構建一個spin應用程序,我正在按照這里找到的示例但是當我去編譯時,我得到了這個錯誤

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

谷歌搜索引導我沒有在哪里,這是我的應用程序的代碼

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"))

  }
}

如果需要,我可以發布更多代碼片段

謝謝,

利亞姆

IO.apply采用隱式ActorSystem 使用implicit var actorSytemactorSystem設為隱式,或者將actorSystem顯式傳遞為IO(Http)(actorSystem)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM