错误信息:

[org.springframework.web.socket.messaging.WebSocketAnnotationMethodMessageHandler]-[DEBUG] No matching message handler methods.

很明显,造成该错误的原因是  @MessageMapping("/hello") 该注解没有生效

本人是因为  在 mvc 配置文件中添加了  use-default-filters="false"  所以造成该原因

SpringMVC 主要就是来管理网站的跳转逻辑,所以在配置扫描的包时,使用 use-default-filters 属性,并设置为 false,即不使用默认的 Filter 进行扫描。

要分析这个错误,就要先了解 use-default-filters 这个属性的作用。use-default-filters 属性的默认值为 true,即使用默认的 Filter 进行包扫描,而默认的 Filter 对标有 @Service,@Controller和@Repository 的注解的类进行扫描,因为前面说过,我们希望 SpringMVC 只来控制网站的跳转逻辑,所以我们只希望 SpringMVC 的配置扫描 @Controllerce 注解标注的类,不希望它扫描其余注解标注的类,所以设置了 use-default-filters 为 false,并使用 context:include-filter 子标签设置其只扫描带有 @Controller 注解标注的类。

解决方法就是把 <context:component-scan base-package="com.dmefx.live" use-default-filters="false"> 中  use-default-filters="false" 删除掉

当然也有可能是别的原因造成的,一定确保MessageMapping 被扫描到,另外注意  spirng 版本 和 jar包冲突问题。

spring websocket报错:No matching message handler methods.的更多相关文章

  1. 解决eclipse spring配置报错:cvc-elt.1: Cannot find the declaration of element

    解决eclipse spring配置报错:cvc-elt.1: Cannot find the declaration of element 'beans'.Referenced file conta ...

  2. 关于子线程使用Toast报错Can't create handler inside thread that has not called Looper.prepare()的解决办法

    形同如下代码,在Thread中调用Toast显示错误信息: new Thread(new Runnable(){ @Override public void run() { try{ weatherD ...

  3. Spring Boot报错 MultipartException The temporary upload...

    Spring Boot报错:尤其是在处理Ribbon这类接口调用型的负载均衡组件,常见问题 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.se ...

  4. PHP+mysql系统报错:PHP message: PHP Warning: Unknown: Failed to write session data (files)

    PHP+mysql系统报错:PHP message: PHP Warning:  Unknown: Failed to write session data (files) 故障现象,后台页面点击没有 ...

  5. jmeter+Jenkins 持续集成中发送邮件报错:MessagingException message: Exception reading response

    已经配置好了发送邮件的相关信息,但是执行完脚本出现报错:MessagingException message: Exception reading response 1.查看Jenkins本次构建的控 ...

  6. Spring Boot 报错记录

    Spring Boot 报错记录 由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决 解决方案1: @SpringBootApplication(exclude = Dat ...

  7. Spring.之.报错:Caused by: java.lang.IllegalArgumentException: No Spring Session store is configured: set the 'spring.session.store-type' property

    Spring.之.报错 No Spring Session store is configured springboot在启动的时候报如下错误: Error starting ApplicationC ...

  8. spring boot 报错 Failed to read HTTP message

    2008-12-13 15:06:03,930 WARN (DefaultHandlerExceptionResolver.java:384)- Failed to read HTTP message ...

  9. Android 线程更新UI报错 : Can't create handler inside thread that has not called Looper.prepare()

    MainActivity中有一个按钮,绑定了save方法 public void save(View view) { String title = titleText.getText().toStri ...

随机推荐

  1. Python day 04

    Day 04 今日内容 补充 1.解释器/编译器 补充:编译型语言和解释型语言? # 编译型:代码写完后,编译器将其变成成另外一个文件,然后交给计算机执行. # 解释型:写完代码交给解释器,解释器会从 ...

  2. maven 安装本地jar

    mvn install:install-file -Dfile=D:/open-api-sdk-2.0.jar -DgroupId=com.jd.open -DartifactId=jd-api-sd ...

  3. bootstrap table 前后端分页(超级简单)

    前端分页:数据库查询所有的数据,在前端进行分页 后端分页:每次只查询当前页面加载所需要的那几条数据 下载bootstrap 下载bootstrap table jquery谁都有,不说了 项目结构:T ...

  4. IIS简单的反向代理设置

    下载IIS扩展 1.URL Rewrite 地址: https://www.iis.net/downloads/microsoft/url-rewrite 2.Application Request ...

  5. laravel——ajax分页&删除&搜索

    一.视图代码 /*搜索*/<form action="javascript:search_brand()" name="searchForm"> & ...

  6. HTML5外包团队:HTML5 Canvas使用教程

    canvas 元素用于在网页上绘制图形. 什么是 Canvas? HTML5 的 canvas 元素使用 JavaScript 在网页上绘制图像. 画布是一个矩形区域,您可以控制其每一像素. canv ...

  7. 《Java8实战》读书笔记

    个人感悟: 1.lambda表达式,补充了JAVA在面向对象之外,面向过程的一面.在写面向过程代码的时候更方面了,甚至可以利用代码来做类似数学公式的运算(P64) 2.流,对集合的操作,就像用SQL对 ...

  8. YY的GCD

    YY的GCD 给出T个询问,询问\(\sum_{i=1}^N\sum_{j=1}^M(gcd(i,j)\in prime)\),T = 10000,N, M <= 10000000. 解 显然质 ...

  9. linux shell实战之知识体系

    1.认识GUN/bash shell 梳理清楚硬件,内核及模块,shell之间的关系:熟悉GUN的bash以及bash shell的功能:学习shell的通配符 2.shell 的变量 变量的设置,取 ...

  10. ImageWatch 无法安装在VS2017环境下的解决方案

    Download: https://marketplace.visualstudio.com/items?itemName=VisualCPPTeam.ImageWatch#qna For Visua ...