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.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
I have searched a lot, but i didn't find a solution.
I hope anyone can help me, thanks in advance.
best regards, patrick
I managed to resolve this issue by adding the following maven dependency:
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>7.0.52</version>
</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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With