李锋镝的博客

  • 首页
  • 时间轴
  • 留言
  • 插件
  • 左邻右舍
  • 我的日常
  • 关于我
    • 关于我
    • 另一个网站
  • 知识库
  • 赞助
Destiny
自是人生长恨水长东
  1. 首页
  2. 原创
  3. 正文

使用Spring MVC的websocket配置时 Tomcat启动报错

2020年2月25日 19258点热度 0人点赞 0条评论
在使用Spring MVC的websocket配置时 Tomcat启动报错
错误信息如下:
[ERROR][localhost-startStop-1] org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:502) Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.socket.server.support.WebSocketHandlerMapping#0': Cannot resolve reference to bean 'org.springframework.web.socket.server.support.WebSocketHttpRequestHandler#0'
while setting bean property 'urlMap' with key [/websocket]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.socket.server.support.WebSocketHttpRequestHandler#0': Cannot resolve reference to bean
'org.springframework.web.socket.server.support.DefaultHandshakeHandler#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.socket.server.support.DefaultHandshakeHandler#0':
Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.socket.server.support.DefaultHandshakeHandler]: Constructor threw exception; nested exception is java.lang.IllegalStateException:
No suitable default RequestUpgradeStrategy found
原因是因为Tomcat版本太老,之前一直用的是apache-tomcat-7.0.42,Spring官网说要用Tomcat7.0.47+的版本(https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#websocket-server),果断升级Tomcat版本为apache-tomcat-7.0.82,问题解决。
附原文:
Currently the list includes WebSocket runtimes such as Tomcat 7.0.47+, Jetty 9.1+, GlassFish 4.1+, WebLogic 12.1.3+, and Undertow 1.0+ (and WildFly 8.0+).

除非注明,否则均为李锋镝的博客原创文章,转载必须以链接形式标明本文链接

本文链接:https://www.lifengdi.com/archives/article/1697

相关文章

  • Spring中的Aware接口
  • 记一次spring-cloud-netflix-core引发的内存溢出分析
  • SpringBoot启动概述(SpringBoot2.1.7)
  • SpringBoot基于redis的分布式锁的实现(源码)
  • 分布式服务生成唯一不重复ID(24位字符串)
本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可
标签: JAVA Spring Spring MVC
最后更新:2020年2月25日

李锋镝

既然选择了远方,便只顾风雨兼程。

打赏 点赞
< 上一篇
下一篇 >

文章评论

1 2 3 4 5 6 7 8 9 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 46 47 48 49 50 51 52 53 54 55 57 58 60 61 62 63 64 65 66 67 69 72 74 76 77 78 79 80 81 82 85 86 87 90 92 93 94 95 96 97 98 99
取消回复

COPYRIGHT © 2025 lifengdi.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Dylan

津ICP备2024022503号-3