nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.json.Json

配置springmvc的时候总是报这个错误:

Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.view.json.MappingJacksonJsonView] for bean with name 'org.springframework.web.servlet.view.json.MappingJacksonJsonView#6b23b0b3' defined in class path resource [spring-mvc.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.json.MappingJacksonJsonView
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1325)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:453)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:276)
	... 40 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.view.json.MappingJacksonJsonView
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:246)
	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:395)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1346)
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1317)
	... 42 more

然后看了一下配置文件:
在这里插入图片描述
点到org.springframework.web.servlet.view.json包下面去看看:
在这里插入图片描述
发现配置错误了,改成
在这里插入图片描述
解决了,因为项目是别人那靠过来的,别人的spring是3.X版本的,我的是4.X版本的,所以…

posted @ 2019-04-23 09:36  你就像甜甜的益达  阅读(519)  评论(0编辑  收藏  举报