In StackOverflow there is such a sentence: The Reflection layer wraps any exception InvocationTargetException in a, which lets you say the difference between an Exception actually caused by a failure in the "Reflection call" (maybe your argument list wasn ' t valid, for EXAMPL e) and a failure within the method called
The reflection layer wraps all the exceptions in a invocationtargetexception, which allows you to distinguish between exceptions that are actually caused by a call failure (such as invalid argument list) and the internal error of the calling method .
That's probably what it means, um *~*.
So, I looked at the parameters of the invoke parameter and the calling method are consistent, after the discovery of consistency, and then check inside the calling method, there is a null pointer exception (lower-level error: )
Problem solving. bingo~
You ' ve added an extra level of abstraction by calling the Method with reflection . the reflection layer wraps any exception in an InvocationTargetException , which lets you tell the Difference between an exception actually caused by a failure in the reflection call (MAYBE YOUR ARGUMENT LIST WASN ' T valid, for example) and a failure within the method called you have through use reflection call Add additional abstract level . Reflective layer will be any exception packing at InvocationTargetException , let you tell actually Cause Exception reflection Call (maybe you parameters list Not valid for example) failure and internal failure Difference Call method
One possible cause of java.lang.reflect.InvocationTargetException