You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/08/08 11:01:34 UTC

[GitHub] [dubbo] zhaoyunxing92 opened a new issue, #10419: 同一个注册中心不同namespace注册失败

zhaoyunxing92 opened a new issue, #10419:
URL: https://github.com/apache/dubbo/issues/10419

   <!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
   
   - [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.0.10
   * Operating System version: mac
   * Java version: 1.8
   
   ### Steps to reproduce this issue
   
   1.xml文件
   ```xml
   <?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
       <modelVersion>4.0.0</modelVersion>
       <parent>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-parent</artifactId>
           <version>2.7.2</version>
           <relativePath/>
       </parent>
   
       <groupId>org.apache.dubbo</groupId>
       <artifactId>dubbo-sample</artifactId>
       <version>0.0.1-SNAPSHOT</version>
       <name>dubbo-sample</name>
   
       <description>dubbo-sample</description>
   
       <properties>
           <java.version>1.8</java.version>
           <dubbo.version>3.0.10</dubbo.version>
           <guava.version>31.1-jre</guava.version>
       </properties>
   
       <dependencies>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter</artifactId>
           </dependency>
   
           <dependency>
               <groupId>org.apache.dubbo</groupId>
               <artifactId>dubbo-spring-boot-starter</artifactId>
               <version>${dubbo.version}</version>
           </dependency>
   
           <dependency>
               <groupId>org.apache.dubbo</groupId>
               <artifactId>dubbo-registry-nacos</artifactId>
               <version>${dubbo.version}</version>
           </dependency>
   
           <dependency>
               <groupId>org.apache.dubbo</groupId>
               <artifactId>dubbo-registry-zookeeper</artifactId>
               <version>${dubbo.version}</version>
           </dependency>
   
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-test</artifactId>
               <scope>test</scope>
           </dependency>
       </dependencies>
   
       <build>
           <plugins>
               <plugin>
                   <groupId>org.springframework.boot</groupId>
                   <artifactId>spring-boot-maven-plugin</artifactId>
               </plugin>
           </plugins>
       </build>
   
   </project>
   
   ```
   2. yaml文件
   ```yaml
   dubbo:
     application:
       name: dubbo-sample
       register-mode: all
     scan:
       base-packages: org.apache.dubbo.sample.service
     protocol:
       name: dubbo
       port: -1
     provider:
       registry-ids: hangzhou,shanghai
     registries:
       hangzhou:
         address: nacos://localhost:8848
         parameters:
           namespace: hangzhou
       shanghai:
         address: nacos://localhost:8848
         parameters:
           namespace: shanghai
   ```
   
   Pls. provide [GitHub address] to reproduce this issue.
   
   ### Expected Behavior
   
   <!-- What do you expect from the above steps?-->
   
   希望可以注册到两个命名空间下
   
   ### Actual Behavior
   
   <!-- What actually happens? -->
   
   If there is an exception, please attach the exception trace:
   3. 遇到的异常
   ```log
   
   java.lang.IllegalStateException: Registry not found: shanghai
   	at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$convertRegistryIdsToRegistries$5(AbstractInterfaceConfig.java:488) ~[dubbo-3.0.10.jar:3.0.10]
   	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:1.8.0_301]
   	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) ~[na:1.8.0_301]
   	at org.apache.dubbo.config.AbstractInterfaceConfig.convertRegistryIdsToRegistries(AbstractInterfaceConfig.java:482) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:259) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:286) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.ServiceConfig.postProcessRefresh(ServiceConfig.java:348) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.AbstractConfig.refresh(AbstractConfig.java:698) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.deploy.DefaultModuleDeployer.exportServiceInternal(DefaultModuleDeployer.java:316) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.deploy.DefaultModuleDeployer.exportServices(DefaultModuleDeployer.java:309) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.deploy.DefaultModuleDeployer.start(DefaultModuleDeployer.java:145) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onContextRefreshedEvent(DubboDeployApplicationListener.java:111) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:100) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:45) ~[dubbo-3.0.10.jar:3.0.10]
   	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.22.jar:5.3.22]
   	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.22.jar:5.3.22]
   	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.22.jar:5.3.22]
   	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.22.jar:5.3.22]
   	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.22.jar:5.3.22]
   	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.22.jar:5.3.22]
   	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.22.jar:5.3.22]
   	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) [spring-boot-2.7.2.jar:2.7.2]
   	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) [spring-boot-2.7.2.jar:2.7.2]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) [spring-boot-2.7.2.jar:2.7.2]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) [spring-boot-2.7.2.jar:2.7.2]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) [spring-boot-2.7.2.jar:2.7.2]
   	at org.apache.dubbo.sample.DubboSampleApplication.main(DubboSampleApplication.java:10) [classes/:na]
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] chickenlj commented on issue #10419: 同一个注册中心不同namespace注册失败

Posted by GitBox <gi...@apache.org>.
chickenlj commented on issue #10419:
URL: https://github.com/apache/dubbo/issues/10419#issuecomment-1234984333

   Fixed in 3.1.0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] lphu commented on issue #10419: 同一个注册中心不同namespace注册失败

Posted by GitBox <gi...@apache.org>.
lphu commented on issue #10419:
URL: https://github.com/apache/dubbo/issues/10419#issuecomment-1296671983

   > Fixed in 3.1.0
   
   想问下 为什么在3.x内比较的时候要忽略id属性, 这是出于什么原因考虑的? 在2.x内最新版也是没有忽略id属性的


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zhaoyunxing92 commented on issue #10419: 同一个注册中心不同namespace注册失败

Posted by GitBox <gi...@apache.org>.
zhaoyunxing92 commented on issue #10419:
URL: https://github.com/apache/dubbo/issues/10419#issuecomment-1208075564

   主要是`AbstractConfig#equals`方法没有看`parameters`的参数
   https://github.com/apache/dubbo/blob/3.0/dubbo-common/src/main/java/org/apache/dubbo/config/context/AbstractConfigManager.java#L161-L167
   ```java
    if (!(config instanceof ReferenceConfigBase || config instanceof ServiceConfigBase)) {
               for (AbstractConfig value : configsMap.values()) {
                   if (value.equals(config)) {
                       return (T) value;
                   }
               }
           }
   ```
   
   [AbstractConfig#equals](https://github.com/apache/dubbo/blob/3.0/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java#L959-L983) 方法列表没有`getParameters()`
   ```java
   public boolean equals(Object obj) {
           if (obj == null || obj.getClass() != this.getClass()) {
               return false;
           }
           if (obj == this) {
               return true;
           }
   
           for (Method method : getAttributedMethods()) {
               // ignore compare 'id' value
               if ("getId".equals(method.getName())) {
                   continue;
               }
               try {
                   Object value1 = method.invoke(this);
                   Object value2 = method.invoke(obj);
                   if (!Objects.equals(value1, value2)) {
                       return false;
                   }
               } catch (Exception e) {
                   throw new IllegalStateException("compare config instances failed", e);
               }
           }
           return true;
       }
   ```
   [MethodUtils.isGetter](https://github.com/apache/dubbo/blob/3.0/dubbo-common/src/main/java/org/apache/dubbo/common/utils/MethodUtils.java#L77)判断返回类型是Map的方法不是get


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] chickenlj closed issue #10419: 同一个注册中心不同namespace注册失败

Posted by GitBox <gi...@apache.org>.
chickenlj closed issue #10419: 同一个注册中心不同namespace注册失败
URL: https://github.com/apache/dubbo/issues/10419


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on issue #10419: 同一个注册中心不同namespace注册失败

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on issue #10419:
URL: https://github.com/apache/dubbo/issues/10419#issuecomment-1297860008

   > > Fixed in 3.1.0
   > 
   > 想问下 为什么在3.x内比较的时候要忽略id属性, 这是出于什么原因考虑的? 在2.x内最新版也是没有忽略id属性的
   
   因为 id 在大部分是时候是自动生成的,而 equal 比较的时候是比较的属性


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org