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

when the interfaceName of the Reference annotation has duplicated,the exception is puzzled #4160

Closed
2 tasks
kexianjun opened this issue May 24, 2019 · 0 comments · Fixed by #4163
Closed
2 tasks
Milestone

Comments

@kexianjun
Copy link
Member

kexianjun commented May 24, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: all
  • Operating System version: win 10
  • Java version: 1.8

Steps to reproduce this issue

  1. consumer more than one service, and specify duplicated interfaceName with different consumer service, such as
    @Reference(check = false, interfaceName = "demoService")
    private DemoService demoService;

    @Reference(check = false, interfaceName = "demoService")
    private DemoServiceB demoServiceB;
  1. run provider
  2. run consumer

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

a more meaningful exception

Actual Result

Caused by: java.lang.IllegalArgumentException: Can not set dubbo.test.api.DemoServiceB field dubbo.test.common.consumer.service.ConsumerServiceDemo.demoServiceB to com.alibaba.dubbo.common.bytecode.proxy0
	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
	at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
	at java.lang.reflect.Field.set(Field.java:764)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceFieldElement.inject(ReferenceAnnotationBeanPostProcessor.java:367)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.postProcessPropertyValues(ReferenceAnnotationBeanPostProcessor.java:92)
	... 12 more

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

Just put your stack trace here!

I think we should check if the type is matched when the interfaceName of Reference annotation is the same.

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

Successfully merging a pull request may close this issue.

2 participants