0

I am getting this error when trying to run my akka application:

[ERROR] [06/30/2014 15:58:14.591] [Thread-3] [RemoteActorRefProvider] Error while looking up address [akka://FooPar0@127.0.0.1:2552] akka.remote.RemoteTransportException: No transport is loaded for protocol: [akka], available protocols: [akka.tcp] at akka.remote.Remoting$.localAddressFo rRemote(Remoting.scala:88) ...

My sbt project has the following build.sbt:

name := "FooPar"

version := "0.1"

scalaVersion := "2.11.1"

resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

resolvers += "Sonatype Releases" at "http://oss.sonatype.org/content/repositories/releases"

libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.4"

libraryDependencies += "com.typesafe.akka" %% "akka-remote" % "2.3.4"

libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.11.4" % "test"

Finally, the generated configuration string for my application looks like this:

akka {
  actor {
    provider = "akka.remote.RemoteActorRefProvider"
  }
  remote { 
        enabled-transports = ["akka.remote.netty.tcp"]

        netty.tcp.hostname = "10.126.13.61" 
        netty.tcp.port = 2552
        netty.tcp.message-frame-size = 20 MiB
        //netty.tcp {
      //    write-buffer-high-water-mark = 148000b
          //  send-buffer-size = 148000b
           // receive-buffer-size = 148000b
        //}
  }

  event-handlers = []
  loglevel=WARNING

}    


my-custom-dispatcher {
//    type = PinnedDispatcher
    executor = thread-pool-executor
    # 10 years should be enough
//    thread-pool-executor.keep-alive-time = 315360000s
    # note that disabling core timeout altogether doesn't work
    # until ticket 2856 is fixed
    thread-pool-executor.allow-core-timeout = off
  mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox"
}

Can someone help me locate the problem? I am following this guide here http://doc.akka.io/docs/akka/2.3.4/scala/remoting.html, but it seems, my configuration file is just as it should be

As a response to Mario:

I am instantiating the ActorSystem from the config-string listed above and then via this code:

  private var system: Option[ActorSystem] = None
  def getSystem(machinefile: String) = synchronized {
    system match {
      case None =>
        system = Some(ActorSystem("FooPar" + indexOf(hostName, machinefile),
          ConfigFactory.parseString(conf))); system
      case Some(sys) => system
    }
  }

That is, I do not create Address objects explicitly.

4

1 回答 1

0

在创建 的实例时,这看起来像一个问题akka.actor.Address。为了远程工作,第一个参数必须"akka.tcp"代替"akka"

val addr = Address("akka.tcp", "actorSystem", hostname, port)

然后,当您想获得对演员的引用时:

val path = RootActorPath(addr) / "user" / "actorName"
val actorRef = context.actorSelection(path)

(请注意,context也可能是system

如评论中所述,由于您使用的是actorFor,请尝试在 URL 中使用akka.tcp://而不是使用。akka://

于 2014-06-30T17:42:38.887 回答