Search code examples
javatomcatspring-websocket

Spring websocket example - error - Are you running in a Servlet container that supports J SR-356?


I am trying to run the Spring 4 example given @ https://spring.io/guides/gs/messaging-stomp-websocket. When I try to connect to socket, it throws me following exception. As per the example you need tomcat 7.0.50 and I checked the executable jar which has right version of tomcat. Any pointer would be helpful.

java.lang.IllegalArgumentException: No 'javax.websocket.server.ServerContainer'   ServletContext attribute. Are you running in a Servlet container that supports JSR-356?

Solution

  • Check that you have tomcat7-websocket.jar and websocket-api.jar bundled in your executable jar - perhaps you're just getting vanilla tomcat without the extra websocket bits.