javax.servlet.ServletException: javax.websocket.DeploymentException: Multiple Endpoints may not be deployed to the same path [/websocket] : existing endpoint was class WebSocketTest and new endpoint is class html5.MyWebSocket
at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.websocket.DeploymentException: Multiple Endpoints may not be deployed to the same path [/websocket] : existing endpoint was class WebSocketTest and new endpoint is class html5.MyWebSocket
at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:225)
at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:279)
at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:120)
... 8 more
启动服务器时,信息中夹杂着这两个异常代码,什么意思呀?
假如你是用tomcat运行的话,如果你注入了
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
并且使用了
@ServerEndpoint()
那么删除掉前者即可
这是stackoverflow的解释
https://stackoverflow.com/questions/31178799/websocket-issue-multiple-endpoints-may-not-be-deployed-to-the-same-path