wd34zc 2017-05-05 07:44 采纳率: 0%
浏览 3701

java websocket html5 启动服务器时抛出异常

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

启动服务器时,信息中夹杂着这两个异常代码,什么意思呀?
  • 写回答

1条回答 默认 最新

  • N+1 2018-04-12 09:15
    关注

    假如你是用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

    评论

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办