diff --git a/akka-actor/src/main/scala/akka/actor/ActorCell.scala b/akka-actor/src/main/scala/akka/actor/ActorCell.scala index fb33b2ab85..8c68ba3315 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorCell.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorCell.scala @@ -509,7 +509,14 @@ private[akka] class ActorCell( checkReceiveTimeout if (system.settings.DebugLifecycle) system.eventStream.publish(Debug(self.path.toString, clazz(created), "started (" + created + ")")) } catch { - case NonFatal(e) ⇒ throw ActorInitializationException(self, "exception during creation", e) + case NonFatal(i: InstantiationException) ⇒ + throw ActorInitializationException(self, + """exception during creation, this problem is likely to occur because the class of the Actor you tried to create is either, + a non-static inner class (in which case make it a static inner class or use Props(new ...) or Props( new UntypedActorFactory ... ) + or is missing an appropriate, reachable no-args constructor. + """, i) + case NonFatal(e) ⇒ + throw ActorInitializationException(self, "exception during creation", e) } } diff --git a/akka-actor/src/main/scala/akka/actor/Props.scala b/akka-actor/src/main/scala/akka/actor/Props.scala index b78c0a5eb4..3751898c5c 100644 --- a/akka-actor/src/main/scala/akka/actor/Props.scala +++ b/akka-actor/src/main/scala/akka/actor/Props.scala @@ -43,14 +43,14 @@ object Props { * Scala API. */ def apply[T <: Actor: ClassManifest]: Props = - default.withCreator(implicitly[ClassManifest[T]].erasure.asInstanceOf[Class[_ <: Actor]].newInstance) + default.withCreator(implicitly[ClassManifest[T]].erasure.asInstanceOf[Class[_ <: Actor]]) /** * Returns a Props that has default values except for "creator" which will be a function that creates an instance * of the supplied class using the default constructor. */ def apply(actorClass: Class[_ <: Actor]): Props = - default.withCreator(actorClass.newInstance) + default.withCreator(actorClass) /** * Returns a Props that has default values except for "creator" which will be a function that creates an instance @@ -70,7 +70,6 @@ object Props { def apply(behavior: ActorContext ⇒ Actor.Receive): Props = apply(new Actor { def receive = behavior(context) }) - } /**