SpringBoot整合webSocket出現Are you running in a Servlet container that supports JSR-356?


如果你使用的是SpringBoot自帶的tomcat出現這種問題 那么換成別的容器就行了。

首先要將已經存在的容器排除掉 使用 exclusions 排除容器依賴 然后再添加別的容器依賴

比如

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-undertow</artifactId> 
</dependency>

如果你使用的恰好是undertow這個容器 那么換成tomcat容器試試

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>

我自己整合的時候沒有出現過這種問題,但是使用開源框架的時候出現了這種問題,

經過排查發現作者使用的是undertow容器。

參考文章:

https://blog.csdn.net/nuoyuezuo/article/details/105664474

https://www.cnblogs.com/ZMargo/articles/13364594.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM