diff --git a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala index aab68f2086..23587198a9 100644 --- a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala +++ b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala @@ -166,4 +166,26 @@ object ReflectiveAccess { case e: Exception => None } + + def resolveMethod(bottomType: Class[_], methodName: String, methodSignature: Array[Class[_]]): java.lang.reflect.Method = { + var typeToResolve = bottomType + var targetMethod: java.lang.reflect.Method = null + var firstException: NoSuchMethodException = null + while((typeToResolve ne null) && (targetMethod eq null)) { + try { + targetMethod = typeToResolve.getDeclaredMethod(methodName, methodSignature:_*) + targetMethod.setAccessible(true) + } catch { + case e: NoSuchMethodException => + if (firstException eq null) + firstException = e + typeToResolve = typeToResolve.getSuperclass + } + } + + if((targetMethod eq null) && (firstException ne null)) + throw firstException + + targetMethod + } } diff --git a/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala b/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala index 7464d47ce3..bc3197d4a1 100644 --- a/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala +++ b/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala @@ -927,7 +927,8 @@ class RemoteServerHandler( val (argClasses, args) = MessageSerializer.deserialize(request.getMessage).asInstanceOf[Tuple2[Array[Class[_]],Array[AnyRef]]] try { - val messageReceiver = typedActor.getClass.getDeclaredMethod(typedActorInfo.getMethod, argClasses: _*) + val messageReceiver = ReflectiveAccess.resolveMethod(typedActor.getClass, typedActorInfo.getMethod, argClasses) + if (request.getOneWay) messageReceiver.invoke(typedActor, args: _*) else { //Sends the response