java.lang.NoSuchMethodError: com.*.(Ljava/lang/Long;)V异常情况处理

 [DUBBO] Got unchecked and undeclared exception which called by 192.168.255.254. service: com.ddyunf.cloud.customer.api.RpcDataCenterService, method: saveDataCenter, exception: java.lang.NoSuchMethodError: com.ddyunf.cloud.es.model.DataCenter.(Ljava/lang/Long;)V, dubbo version: 2.8.4a, current host: 192.168.251.9 java.lang.NoSuchMethodError: com.ddyunf.cloud.es.model.DataCenter.(Ljava/lang/Long;)V
        at com.ddyunf.cloud.es.rpc.RpcDataCenterServiceImpl.saveDataCenter(RpcDataCenterServiceImpl.java:159) ~[customer-cloud-0.0.1-SNAPSHOT.jar:?]
        at com.ddyunf.cloud.es.rpc.RpcDataCenterServiceImpl$$FastClassBySpringCGLIB$$9595f034.invoke() ~[customer-cloud-0.0.1-SNAPSHOT.jar:?]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at com.ddyunf.cloud.common.datasource.DataSourceSelector.chooseDataSource(DataSourceSelector.java:48) ~[common-cloud-0.0.1-SNAPSHOT.jar:?]
        at sun.reflect.GeneratedMethodAccessor221.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE]
        at com.ddyunf.cloud.es.rpc.RpcDataCenterServiceImpl$$EnhancerBySpringCGLIB$$951f5ce6.saveDataCenter() ~[customer-cloud-0.0.1-SNAPSHOT.jar:?]
        at com.alibaba.dubbo.common.bytecode.Wrapper112.invokeMethod(Wrapper112.java) ~[dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) ~[dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) ~[dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) ~[dubbo-2.8.4a.jar:2.8.4a]
        at com.ddyunf.cloud.common.filter.LogFilter.invoke(LogFilter.java:24) ~[common-cloud-0.0.1-SNAPSHOT.jar:?]
        at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) ~[dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) [dubbo-2.8.4a.jar:2.8.4a]
        at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) [dubbo-2.8.4a.jar:2.8.4a]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
处理方案:

本人在调用接口服务时,接口服务异常,

第一,检查代码,可以定位到有对应含参的构造方法,并且也有无参构造函数;

第二,使用set方法进行赋值,依然提示NoSuchMethodError;

第三,经检查代码,确认代码中存在与当前实体类有同名的类,编译通过,但是JVM加错了对象类,加载成另一个同名类,调用方法时抛出NoSuchMethodError的异常。

你可能感兴趣的:(异常处理)