zoukankan      html  css  js  c++  java
  • io.undertow.websockets.jsr.ServerWebSocketContainer cannot be cast to org.apache.tomcat.websocket.server.WsServerContainer

    Caused by: java.lang.ClassCastException: 
    io.undertow.websockets.jsr.ServerWebSocketContainer cannot be cast to org.apache.tomcat.websocket.server.WsServerContainer at org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer(TomcatRequestUpgradeStrategy.java:
    84) at org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer(TomcatRequestUpgradeStrategy.java:47) at org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy.getSupportedExtensions(AbstractStandardUpgradeStrategy.java:88) at org.springframework.web.socket.server.support.AbstractHandshakeHandler.doHandshake(AbstractHandshakeHandler.java:272) at org.springframework.web.socket.server.support.WebSocketHttpRequestHandler.handleRequest(WebSocketHttpRequestHandler.java:166) ... 56 common frames omitted

    问题产生原因是:pom引入的依赖包undertow与websocket依赖包中的tomcat冲突了导致,如下:

    <!--undertow-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-undertow</artifactId>
    </dependency>
    <!--websocket依赖包中本身也依赖tomcat-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-websocket</artifactId>
     </dependency>

    解决方案:

            <!--websocket-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-websocket</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-tomcat</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
  • 相关阅读:
    前端启动摄像头的API
    落谷训练---
    树的遍历 (和) 玩转二叉树 的总结博客
    L2-010 排座位 (并查集)
    最长回文(manacher模板)
    L2-006 树的遍历
    面试题5:从尾到头打印链表
    面试题4:替换空格
    面试题3:二维数组中的查找
    poj 1511(spfa)
  • 原文地址:https://www.cnblogs.com/liaojie970/p/10430610.html
Copyright © 2011-2022 走看看