服务添加链路 blade-starter-trace就出现IllegalStateException: Only one AsyncConfigurer may exist

Blade 未结 1 879
735702544
735702544 剑童 2022-02-20 00:41
悬赏:5

一、该问题的重现步骤是什么?

  1. blade-user 添加链路 blade-starter-trace 启动不起来,提示:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalStateException: Only one AsyncConfigurer may exist

  2. 自己排除发现是 blade-starter-trace引用的spring-cloud-starter-zipkin与 blade-core-boot 同时引用到微服务中就出现此问题

2. 

3.


二、你期待的结果是什么?实际看到的又是什么?

请指导处理这个问题,为什么会出现。


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

BladX 2.9.0  windows10

四、请提供详细的错误堆栈信息,这很重要。

2022-02-19 23:48:00.313  INFO [mib-desk,,,] 22052 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=10c1f230-dac6-3e71-a7e6-0aa518dd6c84

2022-02-19 23:48:00.395  INFO [mib-desk,,,] 22052 --- [           main] o.s.c.l.p.MibPropertySourcePostProcessor : MibPropertySourcePostProcessor init.

2022-02-19 23:48:00.395  INFO [mib-desk,,,] 22052 --- [           main] o.s.c.l.p.MibPropertySourcePostProcessor : MibPropertySourcePostProcessor process @MibPropertySource bean.

2022-02-19 23:48:00.634  WARN [mib-desk,,,] 22052 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalStateException: Only one AsyncConfigurer may exist

2022-02-19 23:48:00.653  INFO [mib-desk,,,] 22052 --- [           main] ConditionEvaluationReportLoggingListener : 


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2022-02-19 23:48:00.718 ERROR [mib-desk,,,] 22052 --- [           main] o.s.boot.SpringApplication               : Application run failed


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalStateException: Only one AsyncConfigurer may exist

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)

at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1341)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1181)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)

at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:229)

at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:723)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)

at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)

at org.springmib.core.launch.MibApplication.run(MibApplication.java:50)

at org.springmib.desk.DeskApplication.main(DeskApplication.java:36)

Caused by: java.lang.IllegalStateException: Only one AsyncConfigurer may exist

at org.springframework.scheduling.annotation.AbstractAsyncConfiguration.setConfigurers(AbstractAsyncConfiguration.java:74)

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.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:725)

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)

... 27 common frames omitted

五、若有更多详细信息,请在下面提供。

项目要上线,修改了包和相关的blade信息,其他功能都ok,自己再修改的的东西都有对比工作一一和原代码对比,没有特殊修改和修改不对的地方,

就只要微服务同时引用blade-core-tool 和blade-starter-trace ,报次错误。而且给测试给blade-auth添加运行也正常。

1条回答
  • 2022-02-20 18:58

    我本地跑了一下,没有报错,你有没有用git私服的原版测试,看看是否能启动成功

    image.png


    关于 Only one AsyncConfigurer may exist 这个错,主要意思就是说 AsyncConfigurer 不能重复,只能有一个存在,而正好blade-core-boot有一个自定义的,你去排查一下看看,或者先把BladeX-Tool的blade-core-boot的这个类注释掉,执行mvn clean install后刷新工程然后再启动实施

    image.png

    0 讨论(0)
提交回复