引起java.lang.reflect.InvocationTargetException的一个可能原因


stackoverflow中有这样一句话: 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

翻译一下就是: 反射层将所有的异常都包装在一个InvocationTargetException 中,能使你区分异常的实际上是反射层的引起的一个调用失败(例如参数列表无效)和调用方法内部的错误

大概意思就是这样,嗯*~*

所以,我查看了invoke参数和调用的方法的参数是否一致,发现一致后,再检查调用方法内部,有个空指针异常(比较低级的错误。。)

问题解决。bingo~

 
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM