Hi Guys, i am experiencing NPE when starting a persistent FSM that is
cluster sharded:
a.a.OneForOneStrategy - null
java.lang.NullPointerException: null
at
akka.persistence.fsm.PersistentFSM$$anonfun$receiveRecover$1.applyOrElse(PersistentFSM.scala:121)
~[akka-persistence_2.11-2.5.3.jar:na]
at
scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
~[scala-library-2.11.9.jar:1.0.1]
at
co.styletheory.user.impl.process.registration.UserRegistrationProcess$$anonfun$receiveRecover$1.applyOrElse(UserRegistrationProcess.scala:60)
~[classes/:na]
at
scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
~[scala-library-2.11.9.jar:1.0.1]
at
akka.persistence.Eventsourced$$anon$3$$anonfun$1.applyOrElse(Eventsourced.scala:452)
~[akka-persistence_2.11-2.5.3.jar:na]
at akka.actor.Actor$class.aroundReceive(Actor.scala:513)
~[akka-actor_2.11-2.5.3.jar:na]
at
co.styletheory.user.impl.process.registration.UserRegistrationProcess.akka$persistence$Eventsourced$$super$aroundReceive(UserRegistrationProcess.scala:10)
~[classes/:na]
at
akka.persistence.Eventsourced$$anon$4.stateReceive(Eventsourced.scala:538)
~[akka-persistence_2.11-2.5.3.jar:na]
at
akka.persistence.Eventsourced$class.aroundReceive(Eventsourced.scala:183)
~[akka-persistence_2.11-2.5.3.jar:na]
at
co.styletheory.user.impl.process.registration.UserRegistrationProcess.aroundReceive(UserRegistrationProcess.scala:10)
~[classes/:na]
[error] a.a.OneForOneStrategy - permits must not be negative
java.lang.IllegalStateException: permits must not be negative
at
akka.persistence.RecoveryPermitter.akka$persistence$RecoveryPermitter$$returnRecoveryPermit(RecoveryPermitter.scala:63)
~[akka-persistence_2.11-2.5.3.jar:na]
at
akka.persistence.RecoveryPermitter$$anonfun$receive$1.applyOrElse(RecoveryPermitter.scala:52)
~[akka-persistence_2.11-2.5.3.jar:na]
at akka.actor.Actor$class.aroundReceive(Actor.scala:513)
~[akka-actor_2.11-2.5.3.jar:na]
at
akka.persistence.RecoveryPermitter.aroundReceive(RecoveryPermitter.scala:32)
~[akka-persistence_2.11-2.5.3.jar:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527)
[akka-actor_2.11-2.5.3.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:496)
[akka-actor_2.11-2.5.3.jar:na]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
[akka-actor_2.11-2.5.3.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
[akka-actor_2.11-2.5.3.jar:na]
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
[akka-actor_2.11-2.5.3.jar:na]
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
[akka-actor_2.11-2.5.3.jar:na]
My FSM looks like this:
class UserRegistrationProcess(implicit val domainEventClassTag:
ClassTag[RegistrationEvent])
extends PersistentFSM[RegistrationStatus, RegistrationForm,
RegistrationEvent] {
println("starting actor process")
override def persistenceId = s"RegistrationProcess-${self.path.name}"
override def applyEvent(domainEvent: RegistrationEvent, currentData:
RegistrationForm): RegistrationForm = {
domainEvent match {
case RegistrationRequested(request) => currentData.fillForm(request)
case UserRegistered(email) => DuplicateRegistrationForm
case UserRegistrationCompleted(email) => CompleteRegistrationForm
case _ => currentData
}
}
startWith(NotRegistered, EmptyRegistrationForm)
when(NotRegistered) {
case Event(InitiateRegistrationProcess(id, request), data) =>
println("test 2")
val senderRef = sender()
goto(Registering) applying RegistrationRequested(request) andThen
(data => senderRef ! data)
case Event(_, data) =>
println("test")
stay replying data
}
when(Registering) {
case Event(MarkUserRegisteredFromDuplicateForm(email), _) =>
val senderRef = sender()
goto(Registered) applying UserRegistered(email) andThen (data =>
senderRef ! data)
case Event(MarkRegistrationComplete(email), _) =>
val senderRef = sender()
goto(Registered) applying UserRegistrationCompleted(email) andThen
(data => senderRef ! data)
case Event(InitiateRegistrationProcess(id, request), data) =>
stay() replying data
}
when(Registered) {
case Event(InitiateRegistrationProcess(id, request), data) =>
stay() replying DuplicateRegistrationForm
case Event(_, data) =>
stay replying data
}
override def receiveRecover: Receive = {
case null =>
case any =>
println("recovering " + any.toString)
super.receiveRecover(any)
}
}
Been debugging from some time and can't figure out why it happens. Any help
is appreciated.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.