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/11 12:08:15 UTC

[GitHub] [dubbo] DaleShay opened a new issue, #10443: ReferenceAnnotationBeanPostProcessor registerReferenceBean 判断beanName重复问题 导致启动失败

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

   <!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
   
   - [ ] 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 11.6 
   * Java version: 1.8.0_221
   
   ### Steps to reproduce this issue
   
   1. 
    DemoService 有 DemoServiceImpl 实现 是 @DubboService ,
    TestService  由 TestServiceImpl 实现   是普通的 @Service
   <img width="1014" alt="image" src="https://user-images.githubusercontent.com/39309978/184127210-bec9732c-f818-4105-b735-c1edec561c45.png">
   <img width="629" alt="image" src="https://user-images.githubusercontent.com/39309978/184127276-ce6b57a6-8d86-4926-bbc7-1a6e3bc3762e.png">
   
   
   2. 
   并在两个不同的地方 用@DubboReference  和 @Resource 引用 ,用相同的beanName 都写为 testService
   <img width="688" alt="image" src="https://user-images.githubusercontent.com/39309978/184126626-7da38dcb-8325-4fa6-ae9e-583af8d4093c.png">
   
   <img width="788" alt="image" src="https://user-images.githubusercontent.com/39309978/184126538-81ee5d82-e196-4c76-9e84-3df914f58676.png">
   
   
   
   ### Actual Behavior
   3. 启动后报错
   
   Description:
   
   The bean 'testService' could not be injected as a 'org.apache.dubbo.springboot.demo.consumer.TestService' because it is a JDK dynamic proxy that implements:
   
   
   Action:
   
   Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching.
   
   4. 如果 TestService 不是 由 TestServiceImpl 实现 的接口,而是直接是 @Service 类 则不报错
   <img width="1272" alt="image" src="https://user-images.githubusercontent.com/39309978/184128452-6b5d989a-d9db-4346-90a7-9384d96d3d47.png">
   
   
   6. 如果 TestService 的实现 是  @DubboService  且引用的地方是 @DubboReference 也不会报错
   <img width="1317" alt="image" src="https://user-images.githubusercontent.com/39309978/184128702-6333f48b-bf18-4e94-a30e-09fea3cf470e.png">
   <img width="752" alt="image" src="https://user-images.githubusercontent.com/39309978/184128731-2ff88f9f-005d-4d4d-81b5-48ddfc42da21.png">
   
   7.目测是 check bean definition  ReferenceAnnotationBeanPostProcessor 
   407 行 beanDefinitionRegistry.containsBeanDefinition(referenceBeanName)  判断有一定的问题
   <img width="821" alt="image" src="https://user-images.githubusercontent.com/39309978/184129295-12cd34a6-1c2b-4bf8-9308-909d71691612.png">
   
   
   8.目前只能命名规范,让它不相同 。
   
   If there is an exception, please attach the exception trace:
   
   ```
   Just put your stack trace here!
   ```
   


-- 
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] liufeiyu1002 commented on issue #10443: ReferenceAnnotationBeanPostProcessor registerReferenceBean 判断beanName重复问题 导致启动失败

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

   > 这是个问题,我们在升级到 Dubbo3 的过程中,很多很多服务遇到了这个问题,改起来非常麻烦,几乎得把所有的 @resource 全部改成 @Autowired,影响面非常大,所有服务都得做回归测试。
   > 
   > @liufeiyu1002 Dubbo 做出了这些改动要充分考虑到影响,为什么没有其他的框架有类似的问题。而且这个问题出的很诡异,报的错和 Dubbo 无关,是什么「JDK dynamic proxy that implements」,网上搜到的都是错误答案。我们排查了几天,一步步跟进 Spring 对 Bean 处理的地方,最终才定位到 Dubbo3 身上。
   > 
   > 建议重开这个 issue 充分讨论,我也将再提个新的 issue。
   当然 你的问题也可以提出 issue一块看看
   


-- 
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] liufeiyu1002 commented on issue #10443: ReferenceAnnotationBeanPostProcessor registerReferenceBean 判断beanName重复问题 导致启动失败

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

   `@DubboReference` 是按照属性名称注入 `spring` 容器中的,在`beanFactory`中是 属性名称 对应 `beanDefinition`
   `@Service` 是按照
   使用 `@Autowire ` 不会出现该错误 因为是 `byType` 注入按照实例类型查找的,
   `@Resource` 是 `byName`  按照属性名称注入,,  在查找的时候通过 属性名称 匹配
   我觉得这个不应该是 `dubbo` 的 bug,如果你的 DemoServiceImpl 在 consumer项目中 且 手动指定了@service("testService") 同样会报错,和 dubbo 无关


-- 
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] liufeiyu1002 commented on issue #10443: ReferenceAnnotationBeanPostProcessor registerReferenceBean 判断beanName重复问题 导致启动失败

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

   这个本身就是 对spring 使用的问题  是 ` @resource`  和 `@autowired` 的区别, dubbo 的注解 一直就是 属性名称注入的吧 和版本没关系吧?


-- 
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 #10443: ReferenceAnnotationBeanPostProcessor registerReferenceBean 判断beanName重复问题 导致启动失败

Posted by GitBox <gi...@apache.org>.
chickenlj closed issue #10443: ReferenceAnnotationBeanPostProcessor  registerReferenceBean  判断beanName重复问题 导致启动失败
URL: https://github.com/apache/dubbo/issues/10443


-- 
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] DaleShay commented on issue #10443: ReferenceAnnotationBeanPostProcessor registerReferenceBean 判断beanName重复问题 导致启动失败

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

   看了下 和 https://github.com/apache/dubbo/issues/10335 类似 ,但感觉不是相同的问题,如果TestService 是 dubboService 的话我这里是能启动成功的。 


-- 
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] liuzhiguo630 commented on issue #10443: ReferenceAnnotationBeanPostProcessor registerReferenceBean 判断beanName重复问题 导致启动失败

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

   这是个问题,我们在升级到 Dubbo3 的过程中,很多很多服务遇到了这个问题,改起来非常麻烦,几乎得把所有的 @Resource 全部改成 @Autowired,影响面非常大,所有服务都得做回归测试。
   
   @liufeiyu1002 Dubbo 做出了这些改动要充分考虑到影响,为什么没有其他的框架有类似的问题。而且这个问题出的很诡异,报的错和 Dubbo 无关,是什么「JDK dynamic proxy that implements」,网上搜到的都是错误答案。我们排查了几天,一步步跟进 Spring 对 Bean 处理的地方,最终才定位到 Dubbo3 身上。
   
   建议重开这个 issue 充分讨论,我也将再提个新的 issue。


-- 
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] liufeiyu1002 commented on issue #10443: ReferenceAnnotationBeanPostProcessor registerReferenceBean 判断beanName重复问题 导致启动失败

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

   > 
   
   需要替换未 autowired  大多是因为不同类型 属性名称重复使用


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