JooKS-me opened a new issue #2168:
URL: https://github.com/apache/incubator-shenyu/issues/2168


   ### Is there an existing issue for this?
   
   - [X] I have searched the existing issues
   
   ### Current Behavior
   
   Add the following code to `pom.xml` to shenyu-bootstrap
   ```
           <!--if you use websocket proxy start this-->
           <dependency>
               <groupId>org.apache.shenyu</groupId>
               
<artifactId>shenyu-spring-boot-starter-plugin-websocket</artifactId>
               <version>${project.version}</version>
           </dependency>
   ```
   
   And then, start ShenyuBootstrapApplication.
   
   Finally, start failed.
   
   
   ### Expected Behavior
   
   start successfully 
   
   ### Steps To Reproduce
   
   1. add the dependency of websocket plugin
   2. start ShenyuBootstrapApplication
   
   ### Environment
   
   ```markdown
   ShenYu version(s):newest in master
   ```
   
   
   ### Debug logs
   
   ```
   2021-09-29 13:18:37 [main] INFO  
org.apache.shenyu.bootstrap.ShenyuBootstrapApplication - Starting 
ShenyuBootstrapApplication on zhukunshuaideMacBook-Pro.local with PID 8207 
(/Users/zhukunshuai/github/incubator-shenyu/shenyu-bootstrap/target/classes 
started by zhukunshuai in /Users/zhukunshuai/github/incubator-shenyu)
   2021-09-29 13:18:37 [main] INFO  
org.apache.shenyu.bootstrap.ShenyuBootstrapApplication - The following profiles 
are active: local
   2021-09-29 13:18:39 [main] INFO  
org.springframework.data.repository.config.RepositoryConfigurationDelegate - 
Multiple Spring Data modules found, entering strict repository configuration 
mode!
   2021-09-29 13:18:39 [main] INFO  
org.springframework.data.repository.config.RepositoryConfigurationDelegate - 
Bootstrapping Spring Data Redis repositories in DEFAULT mode.
   2021-09-29 13:18:39 [main] INFO  
org.springframework.data.repository.config.RepositoryConfigurationDelegate - 
Finished Spring Data repository scanning in 20ms. Found 0 Redis repository 
interfaces.
   2021-09-29 13:18:39 [main] WARN  
org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext
 - Exception encountered during context initialization - cancelling refresh 
attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'localPluginController' defined in file 
[/Users/zhukunshuai/github/incubator-shenyu/shenyu-web/target/classes/org/apache/shenyu/web/controller/LocalPluginController.class]:
 Unsatisfied dependency expressed through constructor parameter 0; nested 
exception is org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'pluginDataSubscriber' defined in class path resource 
[org/apache/shenyu/springboot/starter/gateway/ShenyuConfiguration.class]: Bean 
instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.apache.shenyu.sync.data.api.PluginDataSubscriber]: Factory meth
 od 'pluginDataSubscriber' threw exception; nested exception is 
java.lang.IllegalStateException: Duplicate key 
org.apache.shenyu.plugin.websocket.handler.WebSocketPluginDataHandler@58a2b4c
   2021-09-29 13:18:39 [main] INFO  
org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener
 - 
   
   Error starting ApplicationContext. To display the conditions report re-run 
your application with 'debug' enabled.
   2021-09-29 13:18:39 [main] ERROR org.springframework.boot.SpringApplication 
- Application run failed
   org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'localPluginController' defined in file 
[/Users/zhukunshuai/github/incubator-shenyu/shenyu-web/target/classes/org/apache/shenyu/web/controller/LocalPluginController.class]:
 Unsatisfied dependency expressed through constructor parameter 0; nested 
exception is org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'pluginDataSubscriber' defined in class path resource 
[org/apache/shenyu/springboot/starter/gateway/ShenyuConfiguration.class]: Bean 
instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.apache.shenyu.sync.data.api.PluginDataSubscriber]: Factory method 
'pluginDataSubscriber' threw exception; nested exception is 
java.lang.IllegalStateException: Duplicate key 
org.apache.shenyu.plugin.websocket.handler.WebSocketPluginDataHandler@58a2b4c
        at 
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798)
        at 
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:228)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1358)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
        at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
        at 
org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66)
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
        at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
        at 
org.apache.shenyu.bootstrap.ShenyuBootstrapApplication.main(ShenyuBootstrapApplication.java:35)
   Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'pluginDataSubscriber' defined in class path resource 
[org/apache/shenyu/springboot/starter/gateway/ShenyuConfiguration.class]: Bean 
instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.apache.shenyu.sync.data.api.PluginDataSubscriber]: Factory method 
'pluginDataSubscriber' threw exception; nested exception is 
java.lang.IllegalStateException: Duplicate key 
org.apache.shenyu.plugin.websocket.handler.WebSocketPluginDataHandler@58a2b4c
        at 
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
        at 
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207)
        at 
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885)
        at 
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)
        ... 19 common frames omitted
   Caused by: org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [org.apache.shenyu.sync.data.api.PluginDataSubscriber]: Factory 
method 'pluginDataSubscriber' threw exception; nested exception is 
java.lang.IllegalStateException: Duplicate key 
org.apache.shenyu.plugin.websocket.handler.WebSocketPluginDataHandler@58a2b4c
        at 
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at 
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
        ... 33 common frames omitted
   Caused by: java.lang.IllegalStateException: Duplicate key 
org.apache.shenyu.plugin.websocket.handler.WebSocketPluginDataHandler@58a2b4c
        at 
java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
        at 
java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:1990)
        at 
java.util.stream.Collectors.lambda$toConcurrentMap$59(Collectors.java:1472)
        at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at 
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
        at 
org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber.<init>(CommonPluginDataSubscriber.java:50)
        at 
org.apache.shenyu.springboot.starter.gateway.ShenyuConfiguration.pluginDataSubscriber(ShenyuConfiguration.java:117)
        at 
org.apache.shenyu.springboot.starter.gateway.ShenyuConfiguration$$EnhancerBySpringCGLIB$$99b90af0.CGLIB$pluginDataSubscriber$1(<generated>)
        at 
org.apache.shenyu.springboot.starter.gateway.ShenyuConfiguration$$EnhancerBySpringCGLIB$$99b90af0$$FastClassBySpringCGLIB$$9227fb49.invoke(<generated>)
        at 
org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at 
org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
        at 
org.apache.shenyu.springboot.starter.gateway.ShenyuConfiguration$$EnhancerBySpringCGLIB$$99b90af0.pluginDataSubscriber(<generated>)
        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.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 34 common frames omitted
   ```
   
   ### Anything else?
   
   _No response_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to