Sep 18, 2017 I think this is a bug. The JettyRequestUpgradeStrategy implements Lifecycle, as well as DefaultHandshakeHandler, which really delegates the start invocation to the target JettyRequestUpgradeStrategy. When we deal with the Spring WebSocket support (@EnableWebSocketMessageBroker), we configure something like.
I need Websockets for real-time updates in my application. So i found this example and did it step by step here. I went through the tutorial and finally i got this exception when starting the application:
'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
I have searched a lot, but i didn't find a solution.
I hope anyone can help me, thanks in advance.
best regards, patrick
patpat
6 Answers
I managed to resolve this issue by adding the following maven dependency:
As pointed by Craig Otis, if you're planning on deploying to Tomcat anyway, you should use
<scope>test</scope>
to ensure you don't include the dependency in your build artifact.Balázs PalkóBalázs Palkó
I was facing this issue while running websockets in IDE using embedded Jetty, fixed this after adding the below dependencies to pom.xml
Munish ChandelMunish Chandel
The version of Tomcat that you are using is too old.
Upgrade tomcat. http://tomcat.apache.org/download-70.cgi
Tk421Tk421
I am also facing this problem, got across a link see if this is helpful https://github.com/rstoyanchev/spring-websocket-portfolio/issues/21
PrabhatPrabhat
The exception means DefaultHandshakeHandler cannot find a supported servers (e.g. Tomcat 7 & 8, Jetty 9). Refer to the javadoc here.
raymondraymond
I lost a lot of time digging out for the solution, what i found was that spring websocket will only run over Tomcat 7.0.47+, Jetty 9.1+, GlassFish 4.1+, WebLogic 12.1.3+, and Undertow 1.0+ (and WildFly 8.0+) according to spring's documentation shown here http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html, so try updating your app server
darkconejadarkconeja