记:websocket 启动异常 (Failed to register @ServerEndpoint)
springboot集成websocket启动异常信息
java.lang.IllegalStateException: Failed to register @ServerEndpoint class:
springboot集成websocket引用依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
原websocket服务类
@ServerEndpoint("socket/echo/{sid}")
@Component
public class WebSocketServer {…}
@ServerEndpoint 注解中配置路径必须以"/" 开头
@ServerEndpoint("/socket/echo/{sid}")
注:
使用tomcat
初始化构建websocket时,org. apache. tomact. websocket. service. UriTemplate
对path进行检验,必须以"/"开头
版权声明:本文为weixin_41099217原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。