170525、解决maven隐式依赖包版本问题
今天在使用dubbo2.5.3版本的时候,启动项目的时候发现一个问题,tomcat启动一直报错
Caused by: java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher仔细看来,我用的jdk1.8 ,编译也是jdk1.8,仔细想想有可能式是jar包冲突,仔细排查是dubbo默认引用的spring版本太低了导致的,如图
解决方案:
通过
maven的 <exclusions>标签解决类包依赖冲突
<dependency> <groupId>com.alibaba</groupId> <artifactId>dubbo</artifactId> <version>2.5.3</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring</artifactId> </exclusion> </exclusions> </dependency>
这样就去掉了隐式引用
再编译启动正常了
PS:网上我看有很多博文,是降低jdk或者升级spring版本,我没有试验,不知道可不可行
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Brainfly: 用 C# 类型系统构建 Brainfuck 编译器
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· Tinyfox 发生重大改版
· DeepSeek 全面指南,95% 的人都不知道的9个技巧(建议收藏)
· 对比使用DeepSeek与文新一言,了解DeepSeek的关键技术论文
· Brainfly: 用 C# 类型系统构建 Brainfuck 编译器
· DeepSeekV3+Roo Code,智能编码好助手