先找到这个 https://www.cnblogs.com/ginponson/p/6390975.html 我看着意思是要把我的WEBSOCKET的资源放到SERVLET里加载
我想是跟WEB.XML的加载顺序有关
搜到了这个https://blog.csdn.net/hongshan50/article/details/7335443
等于说顺序是context-param -> listener-> filter -> servlet
我本来把WEBSOCKET的BEAN放在了context-param里
现在放到SERVLET里
这下TOMCAT的日志
Mapped URL path [/websocket] onto handler of type [class org.springframework.web.socket.server.support.WebSocketHttpRequestHandler]
出现得靠后了点
但是还是404
我的BEAN是这样设置的
<bean id="websocket" class="cooperation.websocket.handler.websocketHandler"/>
<websocket:handlers>
<websocket:mapping path="/websocket" handler="websocket"/>
<websocket:handshake-interceptors>
<bean class="cooperation.websocket.handShakeInterceptor"/>
</websocket:handshake-interceptors>
</websocket:handlers>
也加载了 但就是404 WS换成ws://localhost:8080/project/websocket还是ws://localhost:8080/websocket都报404
网上还有说是TOMCAT7的WEBSOCK-API的问题,我虽然用的是TOM8,但还是检查了一下,没有问题
update:已经解决 拦截器的问题
网友评论