Skip to content

Can't start normally when use nacosRegistry even provider already register. #7339

@horizonzy

Description

@horizonzy

Environment

  • Dubbo version: master

Steps to reproduce this issue

  1. modify dubbo-demo-xml-consumer/spring/dubbo-consumer.xml
    2.start dubbo-demo-xml-consumer/Application

Expected Result

in migrationInvoker.migrateToServiceDiscoveryInvoker(false);
first call refreshServiceDiscoveryInvoker(), in the process, it will use metadataReport, but nacosMetadataReport didn't support
service app mapping, so the serviceName is empty, and check is true, then throw the exception.

If fact, refreshInterfaceInvoker() will create invoker normally.

So the check should consider both situaion.

If there is an exception, please attach the exception trace:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Should has at least one way to know which services this interface belongs to, subscription url: consumer://192.168.0.101/org.apache.dubbo.demo.DemoService?REGISTRY_CLUSTER=org.apache.dubbo.config.RegistryConfig&application=demo-consumer&category=providers,configurators,routers&check=true&dubbo=2.0.2&enable-auto-migration=true&enable.auto.migration=true&init=false&interface=org.apache.dubbo.demo.DemoService&mapping-type=metadata&mapping.type=metadata&metadata-type=remote&methods=sayHello,sayHelloAsync&pid=6886&qos.port=33333&side=consumer&sticky=false&timestamp=1615218681551
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:176)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1827)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1265)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1115)
	at org.apache.dubbo.demo.consumer.Application.main(Application.java:34)
Caused by: java.lang.IllegalStateException: Should has at least one way to know which services this interface belongs to, subscription url: consumer://192.168.0.101/org.apache.dubbo.demo.DemoService?REGISTRY_CLUSTER=org.apache.dubbo.config.RegistryConfig&application=demo-consumer&category=providers,configurators,routers&check=true&dubbo=2.0.2&enable-auto-migration=true&enable.auto.migration=true&init=false&interface=org.apache.dubbo.demo.DemoService&mapping-type=metadata&mapping.type=metadata&metadata-type=remote&methods=sayHello,sayHelloAsync&pid=6886&qos.port=33333&side=consumer&sticky=false&timestamp=1615218681551
	at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.doSubscribe(ServiceDiscoveryRegistry.java:268)
	at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.subscribe(ServiceDiscoveryRegistry.java:257)
	at org.apache.dubbo.registry.ListenerRegistryWrapper.subscribe(ListenerRegistryWrapper.java:105)
	at org.apache.dubbo.registry.integration.DynamicDirectory.subscribe(DynamicDirectory.java:151)
	at org.apache.dubbo.registry.integration.RegistryProtocol.doCreateInvoker(RegistryProtocol.java:498)
	at org.apache.dubbo.registry.integration.InterfaceCompatibleRegistryProtocol.getServiceDiscoveryInvoker(InterfaceCompatibleRegistryProtocol.java:65)
	at org.apache.dubbo.registry.client.migration.MigrationInvoker.refreshServiceDiscoveryInvoker(MigrationInvoker.java:291)
	at org.apache.dubbo.registry.client.migration.MigrationInvoker.migrateToServiceDiscoveryInvoker(MigrationInvoker.java:112)
	at org.apache.dubbo.registry.client.migration.MigrationRuleHandler.doMigrate(MigrationRuleHandler.java:60)
	at org.apache.dubbo.registry.client.migration.MigrationRuleListener.onRefer(MigrationRuleListener.java:103)
	at org.apache.dubbo.registry.integration.RegistryProtocol.interceptInvoker(RegistryProtocol.java:471)
	at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:457)
	at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:451)
	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.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java)
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:367)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:305)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:204)
	at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:68)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169)
	... 7 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions