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/12/06 03:08:48 UTC

[GitHub] [dubbo] peachyy opened a new issue, #11080: dubbo2.7.13升级到3.0.11版本 兼容性问题启动报错

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

   
   ### Environment
   
   * Dubbo version: 2.7.13 升级到3.0.11
   * Operating System version: window
   * Java version: 1.8
   
   ### Steps to reproduce this issue 重现此问题的步骤
   
   1. 当一个应用实例的某个接口在本应用中用    `@Autowired` 注入过,并且在本应用其他的业务用`@DubboReference` 过。
   2. 因为历史项目原因 `@Autowired`定义的属性名不是很规范 spring容器是按照类型查找。这种就会出现2个type一样的bean 就报错了,此现状在2.7.13中是正常能跑的
   
   示例如下 
   https://github.com/apache/dubbo-samples.git/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider
   把dubbo版本改为3.0.11 samples默认的这个版本应该也是有问题的。
   新增`IDemoService2.java` `DemoService2Impl.java` 
   
   IDemoService2.java 接口定义
   
   ``` java  
    public interface IDemoService2 {
   }
   ```
   
   DemoService2Impl.java 接口实现
   
   ``` java 
   @DubboService
   public class DemoService2Impl implements IDemoService2 {
       @Autowired
       private DemoService demoService;
   
       @DubboReference
       private DemoService demoServiceRemote;
       public void tet(){
   
       }
   }
   ```
   
   启动异常
   
   `022-12-06 10:58:38.011  WARN 26068 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demoService2': Unsatisfied dependency expressed through field 'demoService'; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.apache.dubbo.springboot.demo.DemoService' available: expected single matching bean but found 2: demoServiceImpl,demoServiceRemote
   2022-12-06 10:58:38.020  INFO 26068 --- [           main] ConditionEvaluationReportLoggingListener : 
   
   Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
   2022-12-06 10:58:38.023 ERROR 26068 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
   
   ***************************
   APPLICATION FAILED TO START
   ***************************
   
   Description:
   
   Field demoService in org.apache.dubbo.springboot.demo.provider.DemoService2 required a single bean, but 2 were found:
   	- demoServiceImpl: defined in file [D:\opensource\dubbo-samples\1-basic\dubbo-samples-spring-boot\dubbo-samples-spring-boot-provider\target\classes\org\apache\dubbo\springboot\demo\provider\DemoServiceImpl.class]
   	- demoServiceRemote: defined in null
   
   
   Action:
   
   Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed
   `
   
   


-- 
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] peachyy closed issue #11080: dubbo2.7.13升级到3.0.11版本 兼容性问题启动报错 Dubbo2.7.13 Upgrade to version 3.0.11 Compatibility Problem Start Exception

Posted by GitBox <gi...@apache.org>.
peachyy closed issue #11080: dubbo2.7.13升级到3.0.11版本 兼容性问题启动报错  Dubbo2.7.13 Upgrade to version 3.0.11 Compatibility Problem Start Exception
URL: https://github.com/apache/dubbo/issues/11080


-- 
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] peachyy commented on issue #11080: dubbo2.7.13升级到3.0.11版本 兼容性问题启动报错 Dubbo2.7.13 Upgrade to version 3.0.11 Compatibility Problem Start Exception

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

   fix code


-- 
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 #11080: dubbo2.7.13升级到3.0.11版本 兼容性问题启动报错 Dubbo2.7.13 Upgrade to version 3.0.11 Compatibility Problem Start Exception

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

   这个是由于 Dubbo 3 中 spring 把所有的 reference bean 都注册到 spring 去了。如果没有指定一个 bean 去 autowire 的话也没法决策是使用本地发布的(service bean)还是订阅的(甚至可能有多个,配置不一样)。
   所以最好是在升级的时候把有问题的都处理掉,提前排除风险。


-- 
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] peachyy commented on issue #11080: dubbo2.7.13升级到3.0.11版本 兼容性问题启动报错 Dubbo2.7.13 Upgrade to version 3.0.11 Compatibility Problem Start Exception

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

   > 这个是由于 Dubbo 3 中 spring 把所有的 reference bean 都注册到 spring 去了。如果没有指定一个 bean 去 autowire 的话也没法决策是使用本地发布的(service bean)还是订阅的(甚至可能有多个,配置不一样)。 所以最好是在升级的时候把有问题的都处理掉,提前排除风险。
   
   是呀 之前项目中都是用的自定义的代码生成器 本地服务全部都是用的spring autowire 。属性名却不是规范的 (ಥ﹏ಥ)


-- 
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