我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。
We recommend using English. If you are non-native English speaker, you can use the translation software.
Which Component
Nacos Discovery,spring-cloud-alibaba 2.1.1
Describe the bug
同一个dubbo服务,有两个版本,在service注解中使用不同的group和version,但是在消费端使用Reference注解,指定引用其中一个group和version启动报错,把不引用的再nacos中下线,则可以正常启动
two dubbo provider,same project name,but have diff provider group and version,consumer Reference one of the group and version,Not found exported service
希望同一服务的service可以支持不同版本同时在线,调用端根据service的group和version调用不同的服务
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'initKlineCache' defined in file [E:\IdeaWorkspace\fshares\fshares-exchange\web\websocket-market\out\production\classes\com\fshares\chain\market\config\InitKlineCache.class]: Invocation of init method failed; nested exception is org.apache.dubbo.rpc.RpcException: Failed to invoke the method getLasted in the service com.fshares.chain.service.market.IKlineService. Tried 1 times of the providers [172.16.17.227:28088] (1/2) from the registry localhost:9090 on the consumer 10.0.75.1 using the dubbo version 2.7.3. Last error is: Failed to invoke remote method: getLasted, provider: dubbo://172.16.17.227:28088/com.fshares.chain.service.market.IKlineService?accepts=1000&anyhost=true&application=websocket-market&bean.name=ServiceBean:com.fshares.chain.service.market.IKlineService:1.0.2:fsdex-1&buffer=8192&check=false&delay=-1&deprecated=false&dispatcher=message&dubbo=2.0.2&dynamic=true&generic=false&group=fsdex-1&heartbeat=5000&interface=com.fshares.chain.service.market.IKlineService&keep.alive=true&lazy=false&methods=getLasted,getById,getList,updateOne,getPrev&payload=16777216&pid=11092&qos.enable=false®ister=true®ister.ip=10.0.75.1&release=2.7.3&remote.application=service-market&retries=0&revision=1.0.2&serialization=kryo&side=consumer&status=server&sticky=false&timeout=5000×tamp=1575283940635&version=1.0.2, cause: org.apache.dubbo.remoting.RemotingException: org.apache.dubbo.remoting.RemotingException: Not found exported service: fsdex-1/com.fshares.chain.service.market.IKlineService:1.0.2:28088 in [service-market/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0:28088, fsdex/com.fshares.chain.service.market.IExchangeRateService:1.0.1:28088, fsdex/com.fshares.chain.service.market.ICurrencyPairTrendService:1.0.1:28088, fsdex/com.fshares.chain.service.market.IKlineService:1.0.1:28088], may be version or group mismatch , channel: consumer: /172.16.17.5:62920 --> provider: /172.16.17.227:28088, message:RpcInvocation [methodName=getLasted, parameterTypes=[class java.lang.String, class java.lang.String], arguments=[FEOS_FBTC, 1m], attachments={path=com.fshares.chain.service.market.IKlineService, input=249, dubbo=2.0.2, interface=com.fshares.chain.service.market.IKlineService, version=1.0.2, timeout=5000, group=fsdex-1}]
org.apache.dubbo.remoting.RemotingException: Not found exported service: fsdex-1/com.fshares.chain.service.market.IKlineService:1.0.2:28088 in [service-market/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0:28088, fsdex/com.fshares.chain.service.market.IExchangeRateService:1.0.1:28088, fsdex/com.fshares.chain.service.market.ICurrencyPairTrendService:1.0.1:28088, fsdex/com.fshares.chain.service.market.IKlineService:1.0.1:28088], may be version or group mismatch , channel: consumer: /172.16.17.5:62920 --> provider: /172.16.17.227:28088, message:RpcInvocation [methodName=getLasted, parameterTypes=[class java.lang.String, class java.lang.String], arguments=[FEOS_FBTC, 1m], attachments={path=com.fshares.chain.service.market.IKlineService, input=249, dubbo=2.0.2, interface=com.fshares.chain.service.market.IKlineService, version=1.0.2, timeout=5000, group=fsdex-1}]
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol.getInvoker(DubboProtocol.java:266)
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:127)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:102)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:193)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:847)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)
at com.fshares.chain.WebsocketApplication.main(WebsocketApplication.java:13)
Caused by: org.apache.dubbo.rpc.RpcException: Failed to invoke the method getLasted in the service com.fshares.chain.service.market.IKlineService. Tried 1 times of the providers [172.16.17.227:28088] (1/2) from the registry localhost:9090 on the consumer 10.0.75.1 using the dubbo version 2.7.3. Last error is: Failed to invoke remote method: getLasted, provider: dubbo://172.16.17.227:28088/com.fshares.chain.service.market.IKlineService?accepts=1000&anyhost=true&application=websocket-market&bean.name=ServiceBean:com.fshares.chain.service.market.IKlineService:1.0.2:fsdex-1&buffer=8192&check=false&delay=-1&deprecated=false&dispatcher=message&dubbo=2.0.2&dynamic=true&generic=false&group=fsdex-1&heartbeat=5000&interface=com.fshares.chain.service.market.IKlineService&keep.alive=true&lazy=false&methods=getLasted,getById,getList,updateOne,getPrev&payload=16777216&pid=11092&qos.enable=false®ister=true®ister.ip=10.0.75.1&release=2.7.3&remote.application=service-market&retries=0&revision=1.0.2&serialization=kryo&side=consumer&status=server&sticky=false&timeout=5000×tamp=1575283940635&version=1.0.2, cause: org.apache.dubbo.remoting.RemotingException: org.apache.dubbo.remoting.RemotingException: Not found exported service: fsdex-1/com.fshares.chain.service.market.IKlineService:1.0.2:28088 in [service-market/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0:28088, fsdex/com.fshares.chain.service.market.IExchangeRateService:1.0.1:28088, fsdex/com.fshares.chain.service.market.ICurrencyPairTrendService:1.0.1:28088, fsdex/com.fshares.chain.service.market.IKlineService:1.0.1:28088], may be version or group mismatch , channel: consumer: /172.16.17.5:62920 --> provider: /172.16.17.227:28088, message:RpcInvocation [methodName=getLasted, parameterTypes=[class java.lang.String, class java.lang.String], arguments=[FEOS_FBTC, 1m], attachments={path=com.fshares.chain.service.market.IKlineService, input=249, dubbo=2.0.2, interface=com.fshares.chain.service.market.IKlineService, version=1.0.2, timeout=5000, group=fsdex-1}]
org.apache.dubbo.remoting.RemotingException: Not found exported service: fsdex-1/com.fshares.chain.service.market.IKlineService:1.0.2:28088 in [service-market/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0:28088, fsdex/com.fshares.chain.service.market.IExchangeRateService:1.0.1:28088, fsdex/com.fshares.chain.service.market.ICurrencyPairTrendService:1.0.1:28088, fsdex/com.fshares.chain.service.market.IKlineService:1.0.1:28088], may be version or group mismatch , channel: consumer: /172.16.17.5:62920 --> provider: /172.16.17.227:28088, message:RpcInvocation [methodName=getLasted, parameterTypes=[class java.lang.String, class java.lang.String], arguments=[FEOS_FBTC, 1m], attachments={path=com.fshares.chain.service.market.IKlineService, input=249, dubbo=2.0.2, interface=com.fshares.chain.service.market.IKlineService, version=1.0.2, timeout=5000, group=fsdex-1}]
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol.getInvoker(DubboProtocol.java:266)
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:127)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:102)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:193)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
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.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:113)
at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:248)
at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:78)
at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:55)
at org.apache.dubbo.common.bytecode.proxy1.getLasted(proxy1.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.invoke(ReferenceAnnotationBeanPostProcessor.java:260)
at com.sun.proxy.$Proxy157.getLasted(Unknown Source)
at com.fshares.chain.market.config.InitKlineCache.lambda$null$0(InitKlineCache.java:39)
at java.util.Arrays$ArrayList.forEach(Arrays.java:3880)
at com.fshares.chain.market.config.InitKlineCache.lambda$afterPropertiesSet$1(InitKlineCache.java:31)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at com.fshares.chain.market.config.InitKlineCache.afterPropertiesSet(InitKlineCache.java:31)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
... 15 common frames omitted
Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.RemotingException: org.apache.dubbo.remoting.RemotingException: Not found exported service: fsdex-1/com.fshares.chain.service.market.IKlineService:1.0.2:28088 in [service-market/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0:28088, fsdex/com.fshares.chain.service.market.IExchangeRateService:1.0.1:28088, fsdex/com.fshares.chain.service.market.ICurrencyPairTrendService:1.0.1:28088, fsdex/com.fshares.chain.service.market.IKlineService:1.0.1:28088], may be version or group mismatch , channel: consumer: /172.16.17.5:62920 --> provider: /172.16.17.227:28088, message:RpcInvocation [methodName=getLasted, parameterTypes=[class java.lang.String, class java.lang.String], arguments=[FEOS_FBTC, 1m], attachments={path=com.fshares.chain.service.market.IKlineService, input=249, dubbo=2.0.2, interface=com.fshares.chain.service.market.IKlineService, version=1.0.2, timeout=5000, group=fsdex-1}]
org.apache.dubbo.remoting.RemotingException: Not found exported service: fsdex-1/com.fshares.chain.service.market.IKlineService:1.0.2:28088 in [service-market/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0:28088, fsdex/com.fshares.chain.service.market.IExchangeRateService:1.0.1:28088, fsdex/com.fshares.chain.service.market.ICurrencyPairTrendService:1.0.1:28088, fsdex/com.fshares.chain.service.market.IKlineService:1.0.1:28088], may be version or group mismatch , channel: consumer: /172.16.17.5:62920 --> provider: /172.16.17.227:28088, message:RpcInvocation [methodName=getLasted, parameterTypes=[class java.lang.String, class java.lang.String], arguments=[FEOS_FBTC, 1m], attachments={path=com.fshares.chain.service.market.IKlineService, input=249, dubbo=2.0.2, interface=com.fshares.chain.service.market.IKlineService, version=1.0.2, timeout=5000, group=fsdex-1}]
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol.getInvoker(DubboProtocol.java:266)
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:127)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:102)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:193)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
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)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
at org.apache.dubbo.rpc.protocol.AsyncToSyncInvoker.invoke(AsyncToSyncInvoker.java:56)
at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78)
at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:92)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82)
at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:54)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82)
at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:58)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$CallbackRegistrationInvoker.invoke(ProtocolFilterWrapper.java:157)
at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)
at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:82)
... 32 common frames omitted
Caused by: org.apache.dubbo.remoting.RemotingException: org.apache.dubbo.remoting.RemotingException: Not found exported service: fsdex-1/com.fshares.chain.service.market.IKlineService:1.0.2:28088 in [service-market/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0:28088, fsdex/com.fshares.chain.service.market.IExchangeRateService:1.0.1:28088, fsdex/com.fshares.chain.service.market.ICurrencyPairTrendService:1.0.1:28088, fsdex/com.fshares.chain.service.market.IKlineService:1.0.1:28088], may be version or group mismatch , channel: consumer: /172.16.17.5:62920 --> provider: /172.16.17.227:28088, message:RpcInvocation [methodName=getLasted, parameterTypes=[class java.lang.String, class java.lang.String], arguments=[FEOS_FBTC, 1m], attachments={path=com.fshares.chain.service.market.IKlineService, input=249, dubbo=2.0.2, interface=com.fshares.chain.service.market.IKlineService, version=1.0.2, timeout=5000, group=fsdex-1}]
org.apache.dubbo.remoting.RemotingException: Not found exported service: fsdex-1/com.fshares.chain.service.market.IKlineService:1.0.2:28088 in [service-market/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0:28088, fsdex/com.fshares.chain.service.market.IExchangeRateService:1.0.1:28088, fsdex/com.fshares.chain.service.market.ICurrencyPairTrendService:1.0.1:28088, fsdex/com.fshares.chain.service.market.IKlineService:1.0.1:28088], may be version or group mismatch , channel: consumer: /172.16.17.5:62920 --> provider: /172.16.17.227:28088, message:RpcInvocation [methodName=getLasted, parameterTypes=[class java.lang.String, class java.lang.String], arguments=[FEOS_FBTC, 1m], attachments={path=com.fshares.chain.service.market.IKlineService, input=249, dubbo=2.0.2, interface=com.fshares.chain.service.market.IKlineService, version=1.0.2, timeout=5000, group=fsdex-1}]
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol.getInvoker(DubboProtocol.java:266)
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:127)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:102)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:193)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
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:191)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:153)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:141)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleResponse(HeaderExchangeHandler.java:62)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:199)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
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)
5条答案
按热度按时间jum4pzuy1#
could you provide a project that reproduces the issue?
dwbf0jvd2#
could you provide a project that reproduces the issue?
https://github.com/khiker007/dubbo-spring-version.git
先用test1和test2环境变量启动producer,然后启动consumer,consumer有一定概率启动不起来,及使启动起来,访问接口/test1或/tes2,有一半的概率会找不到service报错
n6lpvg4x3#
well,I try dubbo-spring-starter 2.7.5,it is fix this bug,and I hope its working well spring-cloud-alibaba as soon as posiable
44u64gxh4#
可以看源码在 AbstractSpringCloudRegistry里,首先先服务引用方配置subscribed-services的serviceName 去拿到 List
serviceInstances 和 数据大概是这样的,
然后 findAny 一个 serviceInstance 生成dubboMetadataService的代理
然后调用 dubboMetadataService.getExportedURLs(serviceInterface,group, version) 其中 group 和 version 是 consumer配置的参数,真实的执行是走rpc去serviceInstance提供方获取匹配的providerURL
"dubbo://10.0.31.43:20880/com.melot.dubbo.service.HelloService?anyhost=true&application=provider-service&bean.name=ServiceBean:com.melot.dubbo.service.HelloService:nodejs&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=nodejs&interface=com.melot.dubbo.service.HelloService&methods=test,getUser&pid=25564&release=2.7.4.1&side=provider×tamp=1597059092983"
问题就出在这里,findAny 的serviceInstance 若恰好没有你的group version,那就是启动失败,
若有,他会根据获取的providerURL 和 List serviceInterfaces 里 host port 等信息,组合成 List subcriberURl 通知到 RegistryDirectory 开始生成 invokers,注意 List subcriberURl 里面有一个是错误的,因为List subcriberURl 里的group 和 version 组合生产的,是一样的,而另一个服务是没有 对应subcriberURl的 group version,所以请求到该服务时会Not found exported service
eni9jsuy5#
你用的springcloud版本是哪一个,我用2.2.0.RELEASE版本 version一样 group不一样,启动和请求都是ok的,