score:12

Accepted answer

This exception is usually a consequence of actorSystem.shutdown:

scala> val actorSystem: ActorSystem = ActorSystem("My-Actor-System")
actorSystem: akka.actor.ActorSystem = akka://My-Actor-System

scala> class Aaa extends Actor{ def receive = { case _ => }}
defined class Aaa

scala> actorSystem.actorOf(Props(new Aaa))
res178: akka.actor.ActorRef = Actor[akka://My-Actor-System/user/$a#-842131493]

scala> actorSystem.shutdown

scala> actorSystem.actorOf(Props(new Aaa))
java.lang.IllegalStateException: cannot create children while terminating or terminated
  at akka.actor.dungeon.Children$class.makeChild(Children.scala:200)
  at akka.actor.dungeon.Children$class.attachChild(Children.scala:40)
  at akka.actor.ActorCell.attachChild(ActorCell.scala:369)
  at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:554)
  ... 43 elided

As you're sharing one instance of ActorSystem between many tests by default - it's possible that one of them did shutdown explicitly or implicitly (for example inside after or even afterAll). Also, you have created two actor systems with the same name here - one from (actorSystemConfig: ActorSystemConfig), second from - with ActorSystemConfig (see PolicyDAOSystemTest). First one is shared between all tests in application by default.


Related Query

More Query from same tag