天天看點

app後端服務NoSuchMethodError産生原因分析

1.錯誤日志:

調用後端服務djOrder.getOrderListByPage抛異常:java.lang.NoSuchMethodError,服務不可用。\n異常資訊:\njava.lang.RuntimeException: java.lang.NoSuchMethodError: com.sfAPI.api.dianjiang.service.DJOrderService.listResponse(Ljava\/util\/ArrayList;)Lcom\/sfAPI\/api\/response\/common\/ListResponse;\n\tat com.rop.impl.AnnotationServiceMethodAdapter.invokeServiceMethod(AnnotationServiceMethodAdapter.java:54)\n\tat com.rop.impl.AnnotationServletServiceRouter.doService(AnnotationServletServiceRouter.java:515)\n\tat com.rop.impl.AnnotationServletServiceRouter.access$600(AnnotationServletServiceRouter.java:40)\n\tat com.rop.impl.AnnotationServletServiceRouter$ServiceRunnable.run(AnnotationServletServiceRouter.java:349)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:262)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\n\tat java.lang.Thread.run(Thread.java:745)\nCaused by: java.lang.NoSuchMethodError: com.sfAPI.api.dianjiang.service.DJOrderService.listResponse(Ljava\/util\/ArrayList;)Lcom\/sfAPI\/api\/response\/common\/ListResponse;\n\tat com.sfAPI.api.dianjiang.service.DJOrderService.getOrderListByPage(DJOrderService.java:75)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:606)\n\tat com.rop.impl.AnnotationServiceMethodAdapter.invokeServiceMethod(AnnotationServiceMethodAdapter.java:46)\n\t... 8 more\n

2.關鍵錯誤代碼:java.lang.NoSuchMethodError: com.sfAPI.api.dianjiang.service.DJOrderService.listResponse(Ljava\/util\/ArrayList;)Lcom\/sfAPI\/api\/response\/common\/ListResponse。

分析:找不到DJOrderService類中 ListResponse listResponse(ArrayList list);方法。原因:修改了DJOrderService父類listResponse方法參數ArrayList為List,Build Artifacts後,隻把DJOrderService父類的class檔案更新到伺服器中,而DJOrderService類生成的新的class檔案沒有更新到伺服器中。

3.注意:修改父類方法參數類型,要考慮子類調用該方法産生的影響。

繼續閱讀