diff --git a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala index 098be4835d..e61b66a7fa 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala @@ -578,9 +578,10 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "router FromConfig" must { "throw suitable exception when not configured" in { - intercept[ConfigurationException] { - system.actorOf(Props.empty.withRouter(FromConfig)) - }.getMessage.contains("application.conf") must be(true) + val e = intercept[ConfigurationException] { + system.actorOf(Props[TestActor].withRouter(FromConfig), "routerNotDefined") + } + e.getMessage must include("routerNotDefined") } "allow external configuration" in { diff --git a/akka-actor/src/main/scala/akka/routing/Routing.scala b/akka-actor/src/main/scala/akka/routing/Routing.scala index 7c1dc30db9..3e5b3d137d 100644 --- a/akka-actor/src/main/scala/akka/routing/Routing.scala +++ b/akka-actor/src/main/scala/akka/routing/Routing.scala @@ -33,7 +33,7 @@ private[akka] class RoutedActorRef(_system: ActorSystemImpl, _props: Props, _sup throw new ConfigurationException( "Configuration for " + this + " is invalid - you can not use a 'BalancingDispatcher' as a Router's dispatcher, you can however use it for the routees.") - } else _props.routerConfig.verifyConfig() + } else _props.routerConfig.verifyConfig(_path) override def newCell(old: UnstartedCell): Cell = new RoutedActorCell(system, this, props, supervisor).init(sendSupervise = false) @@ -222,7 +222,7 @@ trait RouterConfig { /** * Check that everything is there which is needed. Called in constructor of RoutedActorRef to fail early. */ - def verifyConfig(): Unit = () + def verifyConfig(path: ActorPath): Unit = () /* * Specify that this router should stop itself when all routees have terminated (been removed). @@ -528,8 +528,8 @@ class FromConfig(val routerDispatcher: String = Dispatchers.DefaultDispatcherId, def this() = this(Dispatchers.DefaultDispatcherId, Router.defaultSupervisorStrategy) - override def verifyConfig(): Unit = - throw new ConfigurationException("router needs external configuration from file (e.g. application.conf)") + override def verifyConfig(path: ActorPath): Unit = + throw new ConfigurationException(s"Configuration missing for router [$path] in 'akka.actor.deployment' section.") def createRoute(routeeProvider: RouteeProvider): Route = null