I am trying to create an actor that can be accessed remotely and locally.
The actor created below throws an exception. Any idea?
val myLocalActor2 = system.actorOf(Props[ActorNodes], name =
"akka://JtsSystem@127.0.0.1:2552/MyOwnRef")
Is this the best and only way to programmatically create and actor that is both local and remote?
The “name” in actorOf is just a path segment. that will identify the newly created actor. See here for more information on that: http://doc.akka.io/docs/akka/2.0.1/general/addressing.html
Also, having something which is both local and remote doesn’t make sense, but I assume you mean that it should be local and be accessible from some remote node? If so, just create it with actorOf, and other nodes may look it up using “actorFor”:
Read more about it here: http://doc.akka.io/docs/akka/2.0.1/scala/remoting.html
In general, please read the documentation, we’ve poured so many hours into it and it feels wasteful when people don’t read it.