搭建spring项目,无法创建RequestMappingHandlerMapping异常
2024-09-05 20:10:43
异常详情:
Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.handler.AbstractHandlerMapping.obtainApplicationContext()Lorg/springframework/context/ApplicationContext;
参考https://blog.csdn.net/u012527870/article/details/81843504,找到原因在于spring的jar包版本冲突
该项目里的spring依赖版本都是5.1.4
<!--参数管理-->
<properties>
<jdk.version>1.8</jdk.version>
<spring.version>5.1.4.RELEASE</spring.version>
</properties> <!--依赖管理-->
<dependencies>
……
<!--spring-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.version}</version>
</dependency>
…… <!--activemq-->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.15.8</version>
</dependency>
</dependencies>
而该项目引入的另一个依赖(activemq-all),本身又依赖了另一个版本的spring
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <groupId>org.apache.activemq</groupId>
<artifactId>activemq-parent</artifactId>
<version>5.15.8</version>
<packaging>pom</packaging>
<name>ActiveMQ</name>
<inceptionYear>2005</inceptionYear> <!--这里的spring版本是4.3.18-->
<spring-version>4.3.18.RELEASE</spring-version> ……
</project>
解决方案:
1. 将该项目依赖的spring版本改为4.3.18
2. 在该项目中引入activemq-all依赖时,排除掉spring
最新文章
- 异步编程系列第01章 Async异步编程简介
- GitHub学习心得之 简单操作
- dbm速算
- Linux下tmpfs与ramfs的区别
- 使用JFinal-weixin配置微信开发
- IP地址,子网掩码,默认网关,路由,形象生动阐述
- 各种排序算法代码(C语言版)
- HDOJ(HDU) 2521 反素数(因子个数~)
- 实例学习SSIS(一)--制作一个简单的ETL包
- 笔记本光驱位安装固态硬盘及window系统一些过程记录
- 【Unity3D技术文档翻译】第1.8篇 AssetBundles 问题及解决方法
- Java数据库操作(MySQL与SQLserver)
- JavaScript限制前端页面用户表单输入
- 7个Java项目,或许你的大学老师就会布置
- 10大H5前端框架(转)
- php 数字 的简单加解密
- signal(SIGCHLD, SIG_IGN)和signal(SIGPIPE, SIG_IGN);
- 剑指offer总结
- ArcEngine几何变换中的策略模式
- STL set集合用法总结(multiset)
热门文章
- 批处理遍历文件夹执行git pull
- jQuery之排他思想
- 封装class类--不分割类名
- c++ Socket客户端和服务端示例版本二
- 命令行执行php脚本中的$argv和$argc配置方法
- i3wm 配置刷新生效 和 使用mod快捷打开 ranger 小贴士
- Beta冲刺-(2/3)
- Insomni&#39;hack teaser 2019 - Pwn - 1118daysober
- fhq_treap || BZOJ 3223: Tyvj 1729 文艺平衡树 || Luogu P3391 【模板】文艺平衡树(Splay)
- Apache HttpClient 读取响应乱码问题总结