Spring websocket 示例 - 错误 - 您是否在支持 J SR-356 的 Servlet 容器中运行? [英] Spring websocket example - error - Are you running in a Servlet container that supports J SR-356?
问题描述
我正在尝试运行 Spring 4 示例@https://spring.io/guides/gs/messaging-stomp-websocket.当我尝试连接到套接字时,它会抛出以下异常.根据示例,您需要 tomcat 7.0.50,我检查了具有正确版本的 tomcat 的可执行 jar.任何指针都会有所帮助.
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?
推荐答案
检查您的可执行文件中是否捆绑了 tomcat7-websocket.jar
和 websocket-api.jar
jar - 也许你只是得到没有额外 websocket 位的普通 tomcat.
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.
这篇关于Spring websocket 示例 - 错误 - 您是否在支持 J SR-356 的 Servlet 容器中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!