今天接到一个开发任务,需要在工程A的原dubbo接口上新增一个方法来支持业务需求,于是分分钟CTRL+C/V完成了开发任务,准备自测;自测方法是首先本地打新的二方SNAPSHOT包,然后启动应用,准备在PAAS平台的服务治理中调用下新接口,看下是否正常;
可是,问题来了!!!
现象1:
在服务治理里面找不到新增的方法;根据之前的经验,通过IDEA的Maven插件,对工程进行clean,然后重新启动;结果——还是找不到新增的方法,只有以前的改接口下的方法;
感觉是打包有问题,于是重新打了SNAPSHOT的包,重启应用,服务治理还是没有新增的方法;
思考了下,可能是ZK中的dubbo接口的方法列表信息并没有被更新,但实际上新方法所在的服务是启动了,于是启动另一个应用B,在B中引用应用A的新SNAPSHOT包,并在代码中通过dubug模式的Evaluate Expression(ALT+F8计算表达式)调用dubbo接口的新增的方法;神奇的现象发生了!
现象2:
新增的方法可以调用成功,并且结果正确的返回;但此时,控制台打印了一串异常,如下:
2022-05-25 17:01:34.761 WARN [0k6yje4qqs8uq8tt76jb4da9v8923bta] [vscheduler-task-executor-1] org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker 84: [DUBBO] Although retry the method queryAppInfoByAppId in the service com.vi.internet.cp.resource.center.facade.game.GamePkgFacade was successful by the provider 172.27.88.88:20880, but there have been failed providers (1/2) from the registry zookeeper.test.vi.xyz:2183 on the consumer 172.27.88.88 using the dubbo version 2.7.8.13-VI. Last error is: Failed to invoke remote method: queryAppInfoByAppId, provider: dubbo://10.184.3.79:20880/com.vi.internet.cp.resource.center.facade.game.GamePkgFacade?anyhost=true&app.env=test&app.loc=sz-sk&app.name=cp-resource-center&application=cp-activity-console&check=false&default=true&deprecated=false&dispatcher=message&dubbo=2.0.2&dynamic=true&generic=false&init=false&interface=com.vi.internet.cp.resource.center.facade.game.GamePkgFacade&methods=batchQueryInternalTestingPkgInfo,queryAppInfoByPkgName&pid=4784®ister.ip=172.27.88.88&release=2.7.8.13-VI&remote.application=cp-resource-center&revision=2.9.5-SNAPSHOT&side=consumer&sticky=false&timeout=3000×tamp=1653392802298&version=1.0.0, cause: org.apache.dubbo.remoting.RemotingException: Fail to decode request due to: java.lang.IllegalArgumentException: Service not found:com.vi.internet.cp.resource.center.facade.game.GamePkgFacade, queryAppInfoByAppId
java.lang.IllegalArgumentException: Service not found:com.vi.internet.cp.resource.center.facade.game.GamePkgFacade, queryAppInfoByAppId
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:142)
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:83)
at org.apache.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:57)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:44)
at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
, dubbo version: 2.7.8.13-VI, current host: 172.27.88.88
org.apache.dubbo.rpc.RpcException: Failed to invoke remote method: queryAppInfoByAppId, provider: dubbo://10.184.3.79:20880/com.vi.internet.cp.resource.center.facade.game.GamePkgFacade?anyhost=true&app.env=test&app.loc=sz-sk&app.name=cp-resource-center&application=cp-activity-console&check=false&default=true&deprecated=false&dispatcher=message&dubbo=2.0.2&dynamic=true&generic=false&init=false&interface=com.vi.internet.cp.resource.center.facade.game.GamePkgFacade&methods=batchQueryInternalTestingPkgInfo,queryAppInfoByPkgName&pid=4784®ister.ip=172.27.88.88&release=2.7.8.13-VI&remote.application=cp-resource-center&revision=2.9.5-SNAPSHOT&side=consumer&sticky=false&timeout=3000×tamp=1653392802298&version=1.0.0, cause: org.apache.dubbo.remoting.RemotingException: Fail to decode request due to: java.lang.IllegalArgumentException: Service not found:com.vi.internet.cp.resource.center.facade.game.GamePkgFacade, queryAppInfoByAppId
java.lang.IllegalArgumentException: Service not found:com.vi.internet.cp.resource.center.facade.game.GamePkgFacade, queryAppInfoByAppId
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:142)
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:83)
at org.apache.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:57)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:44)
at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.apache.dubbo.rpc.protocol.AsyncToSyncInvoker.invoke(AsyncToSyncInvoker.java:73) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:89) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at com.vi.framework.spring.rpc.dubbo.ConsumerFilter.invoke(ConsumerFilter.java:41) ~[vi-commons-2.3.5.20200904-v278-RELEASE.jar:na]
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:51) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:69) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:82) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:260) [dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) [dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) [dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:88) [dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:74) [dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.common.bytecode.proxy8.queryAppInfoByAppId(proxy8.java) [dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at com.vi.internet.cpactivity.service.internaltestingplan.task.IterateRecord2SyncPackagePassedStatusAndNotifyTask.syncPackagePassedStatus(IterateRecord2SyncPackagePassedStatusAndNotifyTask.java:109) [cp-activity-console-service-1.2.4-SNAPSHOT.jar:na]
at com.vi.internet.cpactivity.service.internaltestingplan.task.IterateRecord2SyncPackagePassedStatusAndNotifyTask.execute(IterateRecord2SyncPackagePassedStatusAndNotifyTask.java:65) [cp-activity-console-service-1.2.4-SNAPSHOT.jar:na]
at com.vi.internet.vscheduler.client.internal.execute.TaskExecutor$2.run(TaskExecutor.java:395) [vscheduler-client-1.0.16.20210325-RELEASE.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_72]
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) [na:1.8.0_72]
at java.util.concurrent.FutureTask.run(FutureTask.java) [na:1.8.0_72]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_72]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_72]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72]
Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.RemotingException: Fail to decode request due to: java.lang.IllegalArgumentException: Service not found:com.vi.internet.cp.resource.center.facade.game.GamePkgFacade, queryAppInfoByAppId
java.lang.IllegalArgumentException: Service not found:com.vi.internet.cp.resource.center.facade.game.GamePkgFacade, queryAppInfoByAppId
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:142)
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:83)
at org.apache.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:57)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:44)
at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) ~[na:1.8.0_72]
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) ~[na:1.8.0_72]
at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:181) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.protocol.AsyncToSyncInvoker.invoke(AsyncToSyncInvoker.java:61) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
... 26 common frames omitted
Caused by: org.apache.dubbo.remoting.RemotingException: Fail to decode request due to: java.lang.IllegalArgumentException: Service not found:com.vi.internet.cp.resource.center.facade.game.GamePkgFacade, queryAppInfoByAppId
java.lang.IllegalArgumentException: Service not found:com.vi.internet.cp.resource.center.facade.game.GamePkgFacade, queryAppInfoByAppId
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:142)
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:83)
at org.apache.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:57)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:44)
at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.doReceived(DefaultFuture.java:217) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:179) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:167) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleResponse(HeaderExchangeHandler.java:60) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:181) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.common.threadpool.ThreadlessExecutor.waitAndDrain(ThreadlessExecutor.java:99) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:179) ~[dubbo-2.7.8.13-VI.jar:2.7.8.13-VI]
... 27 common frames omitted
核心的异常信息是:
“ Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.RemotingException: Fail to decode request due to: java.lang.IllegalArgumentException: Service not found:xxx ”
网上搜了下原因,没有找到解决方案;但是根据之前的经验,IDEA本身存在一些问题,如父pom中的
原因是IDEA并没有去主动去拉对应的
这种依赖问题的解决方案是:
将这一段
复制到子模块module的pom中,如XX-service的pom,等待稍许,就会惊喜的发现二方包依赖拉下来了, ;不再标红
因此,推测可能是尽管本次新增dubbo接口的方法的服务已经打包并启动,但是IDEA没有把最新的二方包拉入,启动时还是用的上次的没有新方法的包;于是——
最终的解决方案:
去本地的.m2文件的repository中,手动删除当前包的所有version文件夹,然后重新在IDEA的父pom右键重新导包,然后重启服务,发现新方法可以正常被服务治理发现了,并且可以正常调用,dubbo异常“Service not found“不再出现,问题解决!