apache / dubbo-admin

The ops and reference implementation for Apache Dubbo
https://dubbo.apache.org
Apache License 2.0
4k stars 2.17k forks source link

Multiple ReferenceConfigs issue, when using the function between ApiDocs test and ServiceTest #905

Open wrke1990 opened 2 years ago

wrke1990 commented 2 years ago

Environment

Steps to reproduce this issue

  1. using the ApiDocs function to send a test request(such as:/api/dev/docs/requestDubbo?xxxx), and response well
  2. using the ServiceTest function to send a test request(such as:/api/dev/test), alert message: [System Error, please try again later! Message:Found multiple ReferenceConfigs with unique service name xxxxxxx]
  3. restart Dubbo Admin and switch step order as 2,1; same issue again

Expected Result

Expected all testing function work well

Actual Result

throw exception

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

java.lang.IllegalStateException: Found multiple ReferenceConfigs with unique service name [demo3/com.example.dubbo3demo.facade.DemoFacade:1.0.0], previous: <dubbo:reference sticky="false" retries="0" timeout="1000" version="1.0.0" generic="true" url="dubbo://127.0.0.1:20882" group="demo3" interface="com.example.dubbo3demo.facade.DemoFacade" />, later: <dubbo:reference sticky="false" version="1.0.0" generic="true" group="demo3" interface="com.example.dubbo3demo.facade.DemoFacade" />. There can only be one instance of ReferenceConfig with the same triple (group, interface, version). If multiple instances are required for the same interface, please use a different group or version.
    at org.apache.dubbo.config.context.ConfigManager.checkDuplicatedInterfaceConfig(ConfigManager.java:741)
    at org.apache.dubbo.config.context.ConfigManager.addIfAbsent(ConfigManager.java:611)
    at org.apache.dubbo.config.context.ConfigManager.addConfig(ConfigManager.java:490)
    at org.apache.dubbo.config.context.ConfigManager.addConfig(ConfigManager.java:461)
    at org.apache.dubbo.config.context.ConfigManager.addReference(ConfigManager.java:388)
    at org.apache.dubbo.config.bootstrap.DubboBootstrap.reference(DubboBootstrap.java:446)
    at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:238)
    at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:204)
    at org.apache.dubbo.admin.service.impl.GenericServiceImpl.invoke(GenericServiceImpl.java:83)
    at org.apache.dubbo.admin.controller.ServiceTestController.test(ServiceTestController.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
haoyann commented 2 years ago

Fixd by #814 , #894 , you can use develop branch.