【问题标题】:Cannot Access Play! Internal Actor System无法访问播放!内部演员系统
【发布时间】:2012-04-09 17:40:43
【问题描述】:

我正在关注文档here,因为我想将Actors 添加到应用程序提供的参与者系统中。我尝试使用以下命令导入应用程序参与者系统:

import play.libs.concurrent.Akka

我正在使用sbt compile 调用我的编译并收到以下错误

[error] app/controllers/Application.scala:9: object concurrent is not a member of package play.libs
[error] import play.libs.concurrent.Akka
[error]                  ^
[error] one error found

conf/application.conf

#Disable DBPlugin
dbplugin=disabled

#Disable DB evolutions
evolutionplugin=disabled

#Disable Eh Cache
ehcacheplugin=disabled


# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .

# Root logger:
logger.root=ERROR

# Logger used by the framework:
logger.play=INFO

# Logger provided to your application:
logger.application=DEBUG

akka.default-dispatcher.core-pool-size-max = 64
akka.debug.receive = on

项目/Build.scala

import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

    val appName         = "SomeCoolApp"
    val appVersion      = "1.0"

    val appDependencies = Seq(
      // Add your project dependencies here,
      "com.typesafe.akka" % "akka-actor" % "2.+"
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
      // Add your own project settings here      
    )

}

【问题讨论】:

    标签: scala sbt akka playframework-2.0


    【解决方案1】:

    访问 Play! 2.0内部actor系统,使用

    import play.api.libs.concurrent.Akka.system
    

    请参阅API doc 以了解正确的实现方式。

    【讨论】:

    • 链接应该是:...#play.api.libs.concurrent.Akka$,但 Markdown 将其更改为 ...#...Akka%24,导致链接断开。
    • 我尝试修复它,但没有成功,如果您有任何想法,请继续编辑链接。
    • 自 play 2.5.0 起已弃用您应该注入 ActorSystem
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-27
    • 2015-02-22
    • 1970-01-01
    • 2012-11-15
    • 1970-01-01
    • 2021-04-16
    相关资源
    最近更新 更多