alibaba / spring-cloud-alibaba

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
https://sca.aliyun.com
Apache License 2.0
27.97k stars 8.34k forks source link

泛化调用时出现Service not found:com.alibaba.cloud.dubbo.service.DubboMetadataService, getMetadataInfo #2214

Closed Mars-Shen closed 3 years ago

Mars-Shen commented 3 years ago

我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。 We recommend using English. If you are non-native English speaker, you can use the translation software.

Environment

Steps to reproduce this issue

  1. dubbo通过泛型调用GenericService genericService = reference.get();时出现此问题, 提供端使用了spring cloud alibaba的spring-cloud-starter-dubbo, 其版本为2.1.4, 其dubbo版本为2.7.8

    Expected Result

What do you expected from the above steps? 正常调用, 没有异常

Actual Result

What actually happens? 抛出warn异常, 但是依旧可以正常泛型调用成功,异常为

java.lang.IllegalArgumentException: Service not found:com.alibaba.cloud.dubbo.service.DubboMetadataService, getMetadataInfo
    at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:134)
    at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:80)
    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)
    at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78)
    at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:91)
    at org.apache.dubbo.rpc.protocol.FilterNode.invoke(FilterNode.java:61)
    at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:52)
    at org.apache.dubbo.rpc.protocol.FilterNode.invoke(FilterNode.java:61)
    at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:69)
    at org.apache.dubbo.rpc.protocol.FilterNode.invoke(FilterNode.java:61)
    at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:96)
    at org.apache.dubbo.common.bytecode.proxy0.getMetadataInfo(proxy0.java)
    at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.getMetadataInfo(ServiceInstancesChangedListener.java:181)
    at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.onEvent(ServiceInstancesChangedListener.java:116)
    at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.lambda$subscribeURLs$3(ServiceDiscoveryRegistry.java:337)
    at java.lang.Iterable.forEach(Iterable.java:75)
    at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.subscribeURLs(ServiceDiscoveryRegistry.java:334)
    at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.doSubscribe(ServiceDiscoveryRegistry.java:269)
    at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.subscribe(ServiceDiscoveryRegistry.java:256)
    at org.apache.dubbo.registry.ListenerRegistryWrapper.subscribe(ListenerRegistryWrapper.java:105)
    at org.apache.dubbo.registry.integration.DynamicDirectory.subscribe(DynamicDirectory.java:154)
    at org.apache.dubbo.registry.integration.RegistryProtocol.doCreateInvoker(RegistryProtocol.java:525)
    at org.apache.dubbo.registry.integration.InterfaceCompatibleRegistryProtocol.getServiceDiscoveryInvoker(InterfaceCompatibleRegistryProtocol.java:77)
    at org.apache.dubbo.registry.client.migration.MigrationInvoker.refreshServiceDiscoveryInvoker(MigrationInvoker.java:295)
    at org.apache.dubbo.registry.client.migration.MigrationInvoker.migrateToServiceDiscoveryInvoker(MigrationInvoker.java:112)
    at org.apache.dubbo.registry.client.migration.MigrationRuleHandler.doMigrate(MigrationRuleHandler.java:58)
    at org.apache.dubbo.registry.client.migration.MigrationRuleListener.onRefer(MigrationRuleListener.java:103)
    at org.apache.dubbo.registry.integration.RegistryProtocol.interceptInvoker(RegistryProtocol.java:498)
    at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:483)
    at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:477)
    at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:72)
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:81)
    at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:73)
    at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java)
    at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:378)
    at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:313)
    at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:206)
Mars-Shen commented 3 years ago

引用了dubbo nacos依赖后解决问题

        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-registry-nacos</artifactId>
            <version>${dubbo-registry-nacos.version}</version>
        </dependency>