openshift + spring websocket



我是openshift的新手,目前正在尝试在那里设置我的websocket应用程序,但遇到了一些问题。当我尝试连接时

ws://app domain.rhcloud.com:8000/path

我得到以下异常:

Caused by: java.lang.IllegalArgumentException: No 'javax.websocket.server.Server Container' ServletContext attribute. Are you running in a Servlet container that
supports JSR-356?
    at org.springframework.util.Assert.notNull(Assert.java:112)
    at org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy.getContainer(AbstractStandardUpgradeStrategy.java:68)
    at org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer(TomcatRequestUpgradeStrategy.java:83)
    at org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer(TomcatRequestUpgradeStrategy.java:46)
    at org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy.getSupportedExtensions(AbstractStandardUpgradeStrategy.java:88)
    at org.springframework.web.socket.server.support.DefaultHandshakeHandler.doHandshake(DefaultHandshakeHandler.java:214)
    at org.springframework.web.socket.server.support.WebSocketHttpRequestHandler.handleRequest(WebSocketHttpRequestHandler.java:127)
    ... 25 more

当我在本地运行应用程序时,使用以下url一切都很好:

ws://localhost:8090/path

对于这两种情况,我都使用Tomcat7。弹簧配置:

<websocket:handlers allowed-origins="*">
    <websocket:mapping path="/fight-core" handler="webSocketHandler"/>
    <websocket:handshake-interceptors>
        <ref bean="webSocketHandshakeInterceptor"/>
    </websocket:handshake-interceptors>
</websocket:handlers>

此外,我还尝试过在pom.xml中使用websocket-api依赖项,并且不使用

Kidly建议

显然,这与Spring和Tomcat无关,而是与Openshift的路由层有关;websocket支持似乎仍处于试验阶段,请参阅:*2012年的一篇博客文章解释了这种情况*Openshift官方文档

对于普通WebSocket连接(ws://(,请求被定向到端口8000,而WebSocket安全连接(wss://(使用端口8443,作为如以下示例所示:http://example.example.com:8000https://example.example.com:8443

相关内容

  • 没有找到相关文章

最新更新