找不到合适的默认RequestUpgradeStrategy

时间:2014-02-04 23:18:06

标签: java spring tomcat spring-mvc

我正在尝试在Spring上运行Websocket(不是STOMP,而是常规的websocket),如here所示。但是,在完成本教程后,我得到以下异常:

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: Could not instantiate bean class [org.springframework.web.socket.server.support.DefaultHandshakeHandler]: Constructor threw exception; nested exception is java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found

我在几个版本的Tomcat上得到了这个,最新的(我认为应该有JSR 356支持)是Tomcat 7.0.50

我可能做错了什么?

2 个答案:

答案 0 :(得分:6)

我只需更新到Tomcat 7.0.52即可解决此问题。

答案 1 :(得分:0)

如果你使用jetty

,你需要tomcat websocket
<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-websocket</artifactId>
    <version>8.0.28</version>
</dependency>