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 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器