//遇到invoke方法时,系统会抛出InvocationException //通过InvocationException可以获得TargetException 即原异常 //如: public class ProxyHandler implements InvocationHandler { private Object obj; public ProxyHandler(Object obj) { this.obj = obj; } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = null; Service s = obj.getClass().getAnnotation(Service.class); if (s != null) { // TODO do something before invoke... } try { result = method.invoke(obj, args); } catch (InvocationTargetException e1) { // 向上抛出原始异常... throw e1.getTargetException(); } finally { // TODO finally do something... } return result; } }