apache / dubbo-spi-extensions

Apache Dubbo SPI Extensions
https://dubbo.apache.org/
Apache License 2.0
180 stars 108 forks source link

while springcloudAlibaba combine to DubboApiDocs has some problem #22

Closed mengxzh closed 3 years ago

mengxzh commented 3 years ago

Environment

Steps to reproduce this issue

  1. add SpringCloudAlibaba
  2. add SpringCloudAlibaba Dubbo Stater (gav: G: com.alibaba.cloud A: spring-cloud-starter-dubbo V: 2.2.2.RELEASE)
  3. add DubboAPiDocs like README says 3.1. add @EnableDubboApiDocs on my bootStateApplication with @SpringBootApplication 3.2. add @ApiModule on My DubboService and Add @ApiDoc on my DubboServiceApi and Add @RequestParam on my DubboService Serializable DomainDTO
  4. start Application

Expected Result

In Application Start, DubboApiDocs will expose Annotation for DubboApiDubboServer

Actual Result

Its Blocked in Application Start. I hope in DubboApiDocsServer see my DubboApi

Application Start Trace:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field registry in org.apache.dubbo.apidocs.core.DubboApiDocsAnnotationScanner required a single bean, but 2 were found:
    - defaultSpringCloudRegistryConfig: defined by method 'defaultSpringCloudRegistryConfig' in class path resource [com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationAutoConfiguration.class]
    - org.apache.dubbo.config.RegistryConfig#0: 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
mengxzh commented 3 years ago

by the way, this problem both in DubboApiDocs 2.7.8.1 and 2.7.8.1

KeRan213539 commented 3 years ago

At present, when using spring-cloud-starter-dubbo, "dubbo.registry.address" is not configured as "spring-cloud://localhost" and registry are specified separately, there will be two instances of "org.apache.dubbo.config.RegistryConfig" in the spring container, which will cause this problem. But using "spring-cloud://localhost" will become application level registration. If you do not want to use application level registration and continue to use interface level registration, it is recommended to use "dubbo-spring-boot-starter" instead of "spring-cloud-starter-dubbo".

mengxzh commented 3 years ago

when i use dubbo-spring-boot-stater of properties dubbo.registry.address=nacos://xxx.xxx.xxx.xxx:8848 with version 2.7.8, or use spring-cloud-starter-dubbo of properties dubbo.registry.address=spring-cloud://localhost with applicationLevel, it will seems like this:

2021-03-29 14:33:38.183  INFO 15831 --- [:20880-thread-2] o.a.d.r.p.dubbo.CallbackServiceCodec     :  [DUBBO] Not found exported service: org.apache.dubbo.apidocs.core.providers.IDubboDocProvider:20880 in [dubbo/org.apache.dubbo.apidocs.core.providers.IDubboDocProvider:20880, dubbo/com.yy.e.teachee.seata.rm.demo.api.SeataRmStorageHelloManager:20880, dubbo/com.yy.e.teachee.seata.rm.demo.api.SeataRmStorageManager:20880], may be version or group mismatch , channel: consumer: /172.18.88.103:64522 --> provider: /172.18.88.103:20880, message:RpcInvocation [methodName=$invoke, parameterTypes=[class java.lang.String, class [Ljava.lang.String;, class [Ljava.lang.Object;], arguments=[], attachments={input=387, path=org.apache.dubbo.apidocs.core.providers.IDubboDocProvider, remote.application=dubbo-admin-api-docs, dubbo=2.0.2, interface=org.apache.dubbo.apidocs.core.providers.IDubboDocProvider, version=0.0.0, generic=true}], dubbo version: 2.7.8, current host: 172.18.88.103

org.apache.dubbo.remoting.RemotingException: Not found exported service: org.apache.dubbo.apidocs.core.providers.IDubboDocProvider:20880 in [dubbo/org.apache.dubbo.apidocs.core.providers.IDubboDocProvider:20880, dubbo/com.yy.e.teachee.seata.rm.demo.api.SeataRmStorageHelloManager:20880, dubbo/com.yy.e.teachee.seata.rm.demo.api.SeataRmStorageManager:20880], may be version or group mismatch , channel: consumer: /172.18.88.103:64522 --> provider: /172.18.88.103:20880, message:RpcInvocation [methodName=$invoke, parameterTypes=[class java.lang.String, class [Ljava.lang.String;, class [Ljava.lang.Object;], arguments=[], attachments={input=387, path=org.apache.dubbo.apidocs.core.providers.IDubboDocProvider, remote.application=dubbo-admin-api-docs, dubbo=2.0.2, interface=org.apache.dubbo.apidocs.core.providers.IDubboDocProvider, version=0.0.0, generic=true}]
    at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol.getInvoker(DubboProtocol.java:265) ~[dubbo-2.7.8.jar:2.7.8]
    at org.apache.dubbo.rpc.protocol.dubbo.CallbackServiceCodec.decodeInvocationArgument(CallbackServiceCodec.java:292) ~[dubbo-2.7.8.jar:2.7.8]
    at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:165) [dubbo-2.7.8.jar:2.7.8]
    at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:80) [dubbo-2.7.8.jar:2.7.8]
    at org.apache.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:57) [dubbo-2.7.8.jar:2.7.8]
    at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:44) [dubbo-2.7.8.jar:2.7.8]
    at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) [dubbo-2.7.8.jar:2.7.8]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_271]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_271]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_271]

in console log, it seems like retry 3 times. my demo githubAddress

KeRan213539 commented 3 years ago

I have found the cause of the problem in your demo, which will be fixed in the next version. The current interim solution is not to pass dubbo.provider.group to specify a global group, use the group attribute in the @ DubboService annotation