0
votes

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://[email protected]: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.

1
What are you passing to actorSelection to find the remote actor? - Mario Camou
This is an old codebase that I'm reviving, so still using deprecated way of 'sys.actorFor(name)'. Please have a bucket near you - you might get sick: pastebin.com/uzhPJLdY this is where the nightmare/magic happens. - Felix
Ouch... I've never tried remoting with actorFor but, as a test, try changing akka:// to akka.tcp:// in line 148. I'd seriously think of migrating to actorSelection ASAP since actorFor is now deprecated. Depending on what you're doing, it might just be a thing of changing actorFor to actorSelection and using an Address to select the actor. - Mario Camou
This seems to alleviate the problem. Let me spend a few minutes to see if I can get it working correctly now :D - Felix

1 Answers

0
votes

This looks like a problem when creating the instance of akka.actor.Address. For remoting to work the first parameter has to be "akka.tcp" instead of "akka":

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

Then when you want to get a reference to the actor:

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

(note that context might also be system)

As stated in the comments, since you're using actorFor, try using akka.tcp:// instead of akka:// in the URL.