Tomcat启动后,进行路由访问,报错如上
网上查了解决方案,说是maven配置中JSON版本问题
于是乎。。。。
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError:
com/fasterxml/jackson/databind/exc/InvalidDefinitionException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:175)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:88)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1223)
… 37 common frames omitted
我的Spring版本
<properties>
<spring.groupId>org.springframework</spring.groupId>
***<spring.version>5.0.1.RELEASE</spring.version>***
<mybatis.version>3.4.2</mybatis.version>
<mybatis.spring.version>1.3.2</mybatis.spring.version>
<!-- log4j日志文件管理包版本 -->
<slf4j.version>1.7.7</slf4j.version>
<log4j.version>1.2.17</log4j.version>
</properties>
JSON依赖
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.5</version>
<!-- Map工具类 对标准java Collection的扩展Spring-core.jar需要Commons-collecion.jar
提供类的支持 -->
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
我就将JSON的版本改为更高的版本,
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</dependency>
然后可以访问了,版本的问题有点坑啊,顺便附上maven依赖下载地址
maven依赖下载地址