Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
horizonzy opened this issue Mar 8, 2021 · 0 comments
Closed

Comments

@horizonzy
Copy link
Member

horizonzy commented Mar 8, 2021

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

AlbumenJ pushed a commit that referenced this issue Mar 11, 2021
* Didn't judge check in serviceDiscoveryRegistry, it should take over by ReferenceConfig.checkInvokerAvailable

* remove unnecessary import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant