--勤勤恳恳劳作,只为给你一个家,功成去寻你,你已是三岁孩子的妈
一.问题回顾
在springboot中添加了websocket功能在内置的tomcat中可以启动该功能,但是打包成war包之后在外部tomcat中启动就报如下的错误
javax.websocket.DeploymentException: Multiple Endpoints may not be deployed to the path
二.刨根问底
关于异常原因,可以参考这篇博文:
https://stackoverflow.com/questions/31178799/websocket-issue-multiple-endpoints-may-not-be-deployed-to-the-same-path
三,解决方案
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
注释掉这段代码后就可以了。使用@SpringBootApplication启动类进行启动时需要下面这段代码,但生成war包部署在tomcat中不需要这段