严重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter] for bean with name 'org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0' defined in class path resource [springmvc-context.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter] for bean with name 'org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0' defined in class path resource [springmvc-context.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1745)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)

原因是Spring 3.x 和4.X处理JSON的一个类不一样,而这个东西又配置在xml文件中,所以编译时又无法发现

spring3.x是org.springframework.http.converter.json.MappingJacksonHttpMessageConverter

spring4.x是org.springframework.http.converter.json.MappingJackson2HttpMessageConverter

https://www.iteye.com/topic/1136145

1. <context:annotation-config/>隐式的向Spring 容器注册
AutowiredAnnotationBeanPostProcessor,CommonAnnotationBeanPostProcessor,
PersistenceAnnotationBeanPostProcessor以及RequiredAnnotationBeanPostProcessor这4 个BeanPostProcessor,解决了@Controller标识的类的bean的注入和使用。
2. <mvc:annotation-driven/>隐式注册了DefaultAnnotationHandlerMapping和AnnotationMethodHandlerAdapter两个bean,配置一些messageconverter,解决了@Controller注解的使用前提配置。
第一条中的配置一般在配置包扫描路径扫描之后将其移除,为什么呢:
<context:component-scan base-package="***.***"/> 该配置项其实也包含了自动注入上述"1"中四个bean processor的功能,因此当使用 <context:component-scan/> 后,就可以将 <context:annotation-config/>移除了。
你最后的疑问:不配置<mvc:annotation-driven/>,基本的访问应该是没问题,比如servlet mapping的配置是"*.do", ".do"这种请求可以被正确捕捉和处理,但是如果添加静态资源访问,你可能要将拦截改为"/",此时你再次访问就会发现已经不能被正常拦截了,除非你加上<mvc:annotation-driven/>。<mvc:annotation- driven/>在初始化的时候会自动创建两个对 象,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter 和 org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter

Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter的更多相关文章

  1. Caused by: java.lang.ClassNotFoundException: org.springframework.web.socket.server.standard.ServerEndpointExporter

    Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/web/socket/ ...

  2. maven web 项目中启动报错 Java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

    主要原因是maven项目里面的jar包吗,没有导入到项目中 maven web 项目中启动报错 Java.lang.ClassNotFoundException: org.springframewor ...

  3. SpringMVC Maven项目 java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServle

    今天在搭建SpringMVC开发框架时,遇到了一个问题,尽管在maven的POM.xml文件中配置了项目所依赖的jar包,但在启动项目是已然报错如下: 信息: Starting Servlet Eng ...

  4. java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet解决

    spring配置之后启动报错,如下: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServl ...

  5. idea启动tomcat后访问项目报java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

    一.报错“java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet” 1.File --- ...

  6. eclipse里面配置spring,提示java.lang.ClassNotFoundException:org.springframework.web.servlet.Dispatcher错误

    在eclipse里面创建了一个Dynamic 项目,用到spring,一直提示java.lang.ClassNotFoundException: org.springframework.web.ser ...

  7. java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

    新建Maven 项目的时候报错: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet ...

  8. Caused by: java.lang.ClassNotFoundException: org.springframework.web.filter.FormContentFilter

    又是一个报错,我写代码真的是可以,所有的bug都会被我遇到,所有的问题我都能踩一遍,以前上学的时候同学就喜欢问我问题,因为他们遇到的问题,我早就遇到了......... 看看报错内容: 2019-04 ...

  9. threw load() exception java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet(maven项目git后)

    maven项目git全新项目后启动服务出现的, 错误原因: 进入到tomcat的部署路径.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpw ...

随机推荐

  1. paraview显示指定时间段的时均图(两种方法)

    方法一: 首先计算以后会得到每个时刻的网格数据,如下图: 但是我们只想要比如最后2s的数据,如果直接导入,paraview会把从0s时刻的数据全部加载,做时均图的时候也就是对整个时间段做时均,不是我们 ...

  2. CMakeFiles/species.inc.dir/build.make:57: recipe for target 'CMakeFiles/species.inc' failed

    新装的WSL编译2017.3.4版本的mfix,只要涉及到带化学反应的就会报错: 由于之前从没遇到过,对cmake又不熟悉,所以有些摸不着头脑,后来仔细查看报错提示,发现是在CMakeFiles/sp ...

  3. leetcode 283 Move Zeros; 27 Remove Elements; 26 Remove Duplicated from Sorted Array;

    ,,,,}; //把数组的值赋给vector vector<int> vec(arr, arr+sizeof(arr)/sizeof(int)); 解法一: 时间复杂度O(n) 空间复杂度 ...

  4. jstl 遍历数据

    1   导入 jstl  的  jar 包 2. 页面中添加 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/ ...

  5. Oracle子分区(sub partition)操作

    要重新定义大量分区表. 首先看 SQL Reference 大致了解了 Oracle 的分区修改操作.Alter table 语句的alter_table_partitioning 子句可以分为以下几 ...

  6. Oracle PLSQL INDEX BY Binary_Integer 测试

    [转自] http://blog.chinaunix.net/uid-14669803-id-2921539.html DECLARE TYPE t_list_1 IS TABLE OF VARCHA ...

  7. 【MFC】消息大全

    转自:http://www.cnblogs.com/orez88/articles/2119450.html 消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了.例如,单击鼠标.改变 ...

  8. Coursera 机器学习 第5章 Neural Networks: Learning 学习笔记

    5.1节 Cost Function神经网络的代价函数. 上图回顾神经网络中的一些概念: L  神经网络的总层数. sl  第l层的单元数量(不包括偏差单元). 2类分类问题:二元分类和多元分类. 上 ...

  9. 坐标深圳 | Kubernetes!我要用这样的姿势拥抱你

    欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 从去年至今,容器.Kubernetes话题的热度就持续不减,有人说基于容器 +Kubernetes 的新型 PaaS 将会成为云计算的主流: ...

  10. 数据挖掘:基于Spark+HanLP实现影视评论关键词抽取(1)

    1. 背景 近日项目要求基于爬取的影视评论信息,抽取影视的关键字信息.考虑到影视评论数据量较大,因此采用Spark处理框架.关键词提取的处理主要包含分词+算法抽取两部分.目前分词工具包较为主流的,包括 ...