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>

io.undertow.websockets.jsr.ServerWebSocketContainer cannot be cast to org.apache.tomcat.websocket.server.WsServerContainer的更多相关文章

  1. ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to javax.websocket.server.ServerContainer

    21:09:22.221 [MessageBroker-3] INFO c.t.s.s.impl.StockNewsServiceImpl - [2017-12-16 21:09:22] execut ...

  2. org.apache.catalina.core.DefaultInstanceManager cannot be cast to org.apache.tomcat.InstanceManager

    1.控制台报错信息 严重: Servlet.service() for servlet [jsp] in context with path [/Resource] threw exception [ ...

  3. Hadoop: LongWritable cannot be cast to org.apache.hadoop.io.IntWritable

    写MR Job的时候遇到一个坑爹的异常: LongWritable cannot be cast to org.apache.hadoop.io.IntWritable 当写Map的时候,key的默认 ...

  4. 【原创】大叔问题定位分享(16)spark写数据到hive外部表报错ClassCastException: org.apache.hadoop.hive.hbase.HiveHBaseTableOutputFormat cannot be cast to org.apache.hadoop.hive.ql.io.HiveOutputFormat

    spark 2.1.1 spark在写数据到hive外部表(底层数据在hbase中)时会报错 Caused by: java.lang.ClassCastException: org.apache.h ...

  5. hive orc压缩数据异常java.lang.ClassCastException: org.apache.hadoop.io.Text cannot be cast to org.apache.hadoop.hive.ql.io.orc.OrcSerde$OrcSerdeRow

    hive表在创建时候指定存储格式 STORED AS ORC tblproperties ('orc.compress'='SNAPPY'); 当insert数据到表时抛出异常 Caused by: ...

  6. 用java运行Hadoop程序报错:org.apache.hadoop.fs.LocalFileSystem cannot be cast to org.apache.

    用java运行Hadoop例程报错:org.apache.hadoop.fs.LocalFileSystem cannot be cast to org.apache.所写代码如下: package ...

  7. 报错org.apache.hadoop.mapreduce.lib.input.FileSplit cannot be cast to org.apache.hadoop.mapred.FileSplit

    报错 java.lang.Exception: java.lang.ClassCastException: org.apache.hadoop.mapreduce.lib.input.FileSpli ...

  8. Part 13 Cast and Convert functions in SQL Server

    Part 28 Cast and Convert functions in SQL Server

  9. hadoop错误FATAL org.apache.hadoop.hdfs.server.namenode.NameNode Exception in namenode join java.io.IOException There appears to be a gap in the edit log

    错误: FATAL org.apache.hadoop.hdfs.server.namenode.NameNode Exception in namenode join java.io.IOExcep ...

随机推荐

  1. IP通信基础学习第六周(下)

    硬件地址又称物理地址或MAC地址 以太网的MAC帧格式开始的标志是有11出现时,没电时自动结束 适配器的重要功能:进行串行/并行转换:对数据进行缓存:在计算机的操作系统安装设备驱动系统:实现以太协议 ...

  2. 组件 restful_API

    1 token 认证 2 权限 3 注册器和响应 4 频率组件

  3. rabbitmq 3.7.8基于centos7部署文档

    rabbitmq 3.7.8部署文档 安装erlang 安装依赖环境 yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel ope ...

  4. SCOI 2019 划水记

    (此处不应有目录,爆零的过程得慢慢看) 鸽子来更新游记了 orz UESTC. Day -1 两场傻逼信心考试都没AK. 第一场真的气,一个边界觉得是i - 1,然后不知道为啥改成了i,挂了6个点,然 ...

  5. AutoCAD设置透明度后不起效果

    在AutoCAD中设置了实体的透明度,但是看到的效果是不透明 解决方法: 设置系统变量TRANSPARENCYDISPLAY

  6. mac电脑php+mysql+nginx+phpmyadmin环境搭建

    英文原文:http://blog.frd.mn/install-nginx-php-fpm-mysql-and-phpmyadmin-on-os-x-mavericks-using-homebrew/ ...

  7. out对象

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  8. java 反射得到属性与属性值

    反射可以破坏所有的封装性,比如这次通过反射得到的属性与属性值: /** * 得到属性值 * @param obj */ public static void readAttributeValue(Ob ...

  9. Vue小项目二手书商城:(四)详情页和购物车(emit、prop、computed)

    实现效果: 点击对应商品,对应的商品详情页出现,详情页里面还有“Add to cart”按钮和“×”退出按钮. 点击“Add to cart”可以将商品加入购物车,每件商品只能添加一次,如果把购物车的 ...

  10. H5外包团队 MUI文档技术资料大全

    HTML5+ API缓存:http://www.dcloud.io/docs/api/zh_cn/cache.html h.js:http://www.hcoder.net/h vue.js:http ...