ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Only one AsyncAnnotationBeanPostProcessor may exist within the context 问题排查

2022-05-07 23:32:33  阅读:262  来源: 互联网

标签:nifi xxxx may within jar springframework Only org group


启动tomcat时catalina.out中的错误日志:

1 22:14:29.161 [localhost-startStop-1] ERROR org.springframework.web.servlet.DispatcherServlet - Context initialization failed
2 org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Only one AsyncAnnotationBeanPostProcessor may exist within the context.
3 Offending resource: URL [jar:file:/usr/local/tomcat-xxx/lib/manage-nifi-group-1.0.0-SNAPSHOT.jar!/spring/controller/nifi-group.xml]
4         at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
5         at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
6         at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:72)
7         at org.springframework.scheduling.config.AnnotationDrivenBeanDefinitionParser.parse

定位到出问题的manage-nifi-group-1.0.0-SNAPSHOT.jar中的nifi-group.xml。

项目使用了spring定时器,上述配置文件中有 <task:annotation-driven scheduler=xxx />等定时器相关的配置。

百度错误原因,基本都集中在Spring的配置文件上,要么是<task:annotation-driven>标签重复,要么是文件头中如下内容重复:

<beans xmlns="http://www.springframework.org/schema/beans"
       .......
       xmlns:task="http://www.springframework.org/schema/task"
       xsi:schemaLocation=".........
                    http://www.springframework.org/schema/task
                    http://www.springframework.org/schema/task/spring-task-3.1.xsd
                    ">

 

在项目中仔细查验并未发现上述内容有重复配置的地方,于是继续翻看启动时的日志,发现在上面错误出现前,有以下内容:

1 22:43:55.319 [localhost-startStop-1] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved classpath location [xxx/xxxx/xxxx/xxxx/xx/xxx/schedule/] to resources [URL [jar:file:/usr/local/tomcat-xxx/webapps/xxx/WEB-INF/lib/manage-nifi-group-1.0.0-SNAPSHOT.jar!/com/xxxx/xxxx/xxxx/xxxx/xxxx/schedule/], URL [jar:file:/usr/local/tomcat-xxxx/lib/manage-nifi-group-1.0.0-SNAPSHOT.jar!/com/xxxx/xxxx/xxxx/xxxx/idi/schedule/]]
2 22:43:55.319 [localhost-startStop-1] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Looking for matching resources in jar file [file:/usr/local/tomcat-xxx/webapps/manage-dataflow/WEB-INF/lib/manage-nifi-group-1.0.0-SNAPSHOT.jar]
3 22:43:55.320 [localhost-startStop-1] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Looking for matching resources in jar file [file:/usr/local/tomcat-xxx/lib/manage-nifi-group-1.0.0-SNAPSHOT.jar]

......

 

由此确定问题原因:同事误将manage-nifi-group-1.0.0-SNAPSHOT.jar上传到了tomcat的lib下,同时项目的lib下也有这个包,导致启动tomcat时这个包加载了两遍,Spring的task配置重复加载,从而出现该错误。

 

标签:nifi,xxxx,may,within,jar,springframework,Only,org,group
来源: https://www.cnblogs.com/enjoyable/p/16244505.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有