错误信息:

[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. js中的所有鼠标事件 键盘事件

    https://www.cnblogs.com/torchstar/p/null.html

  2. javascript函数的上下文

    规律1:函数用圆括号调用,函数的上下文是windows对象 所有的全局变量都是windows对象的属性,而函数里面的局部变量,不是windows的属性,不是任何东西的属性,它就是一个变量! 规律2:函 ...

  3. 课后作业机票,赌骰子游戏,switch的使用实例

    一,课后第三题机票 package com.bd22; import java.util.Scanner; public class AirTicket { public static void ma ...

  4. 工作中常用的 Linux 命令

    awk 示例: env变量值如下,需要获得pkg_url的链接值: {"name": "michael", "sex": "mal ...

  5. Python游戏编程入门

    <Python游戏编程入门>这些文章负责整理在这本书中的知识点.注意事项和课后习题的尝试实现.并且对每一个章节给出的最终实例进行分析和注释. 初识pygame:pie游戏pygame游戏库 ...

  6. Mac下文件的编码及修改编码

    brew install enca # Enca语法 Usage: enca [-L LANGUAGE] [OPTION]... [FILE]... enconv [-L LANGUAGE] [OPT ...

  7. .NET Core Agent

    .NET Core Agent 熟悉java的朋友肯定知道java agent,当我看到java agent时我很是羡慕,我当时就想.net是否也有类似的功能,于是就搜索各种资料,结果让人很失望.当时 ...

  8. echarts 角度渐变环形图心得

    今天做了一个图,把自己的遇到的问题和体会记录一下,以防忘记 echarts地址 https://gallery.echartsjs.com/editor.html?c=xEPtLLmG4G 参考官网地 ...

  9. 数据流中的中位数 Find Median from Data Stream

    2019-04-17 16:34:50 问题描述: 问题求解: class MedianFinder { PriorityQueue<Integer> smaller; PriorityQ ...

  10. L - Non-Prime Factors (质数筛选+因子分解)

    In many programming competitions, we are asked to find (or count the number of) Prime Factors of an ...