Accepted answer

This exception is usually a consequence of actorSystem.shutdown:

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

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

scala> actorSystem.actorOf(Props(new Aaa))
res178: = 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
  ... 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