1
votes

From this Akka Serialization documentation http://doc.akka.io/docs/akka/2.4/scala/serialization.html

On the part of serializing actor, I find this to deserialize:

val deserializedActorRef = extendedSystem.provider.resolveActorRef(identifier)

However when I tried that with my ActorSystem that I created like:

val extendedSystem = ActorSystem("myactorsystem") 

I got this message:

method provider in trait ActorRefFactory cannot be accessed in akka.actor.ActorSystem

Access to protected method provider not permitted because enclosing class ClassName in package PackageName is not a subclass of trait ActorRefFactory in package actor where target is defined

Is there anything that I should do before I can use the resolveActorRef function?

1

1 Answers

1
votes

I've got the some issue. I'm guessing that in the documentation they were trying to say to use ExtendedActorSystem instead of ActorSystem (as the name extendedSystemimplies) and then ExtendedActorSystem has public access to provider. I haven't found a way how to use it so I found a workaround using SerializationExtension:

val system = ActorSystem("myactorsystem")
val serialization = SerializationExtension(system)
val deserializedActorRef = serialization.system.provider.resolveActorRef(actorRef)

I hope it helps.