您好,欢迎来到九壹网。
搜索
您的当前位置:首页Are you running in a Servlet container that supports JSR-356?

Are you running in a Servlet container that supports JSR-356?

来源:九壹网
java.lang.IllegalArgumentException: No 'javax.websocket.server.ServerContainer' ServletContext attribute. Are you running in a Servlet container that supports JSR-356?

将websocket的demo拉入自己的项目报错,其实显示的是web容器不包括这个JSR-356,
springboot自带的有tomcat,所以需要看下你更换的web容器,我换的是undertow容器,所以我的springboot启动类需要修改一下

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

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

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

这个问题我也是一脸懵逼,也找不到相同的,所以还是仔细观察才能解决bug。要仔细查看启动代码

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 91gzw.com 版权所有 湘ICP备2023023988号-2

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务