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

 1 21:09:22.221 [MessageBroker-3] INFO  c.t.s.s.impl.StockNewsServiceImpl - [2017-12-16 21:09:22] execute fetch stock news, result = 0
 2 21:09:32.158 [MessageBroker-2] INFO  c.t.s.s.impl.StockNewsServiceImpl - [2017-12-16 21:09:32] execute fetch stock news, result = 0
 3 21:09:42.180 [MessageBroker-2] INFO  c.t.s.s.impl.StockNewsServiceImpl - [2017-12-16 21:09:42] execute fetch stock news, result = 0
 4 org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri=http://localhost:8080/thinkvenus-websocket/482/g1y5fw42/websocket; nested exception is org.springframework.web.socket.sockjs.SockJsTransportFailureException: WebSocket handshake failure; nested exception is java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to javax.websocket.server.ServerContainer
 5     at org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler.handleRequest(SockJsHttpRequestHandler.java:135)
 6     at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51)
 7     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
 8     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
 9     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
10     at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
11     at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
12     at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
13     at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
14     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
15     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
16     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
17     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
18     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
19     at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java:59)
20     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
21     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
22     at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
23     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
24     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
25     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
26     at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
27     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
28     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
29     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
30     at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
31     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
32     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
33     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
34     at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
35     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
36     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
37     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
38     at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115)
39     at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59)
40     at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90)
41 **********************异常开始**********************
42     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
43     at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108)
44 **********************异常结束**********************
45
46     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
47     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
48     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
49     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
50     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
51     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
52     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
53     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
54     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
55     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
56     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
57     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
58     at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2549)
59     at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2538)
60     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
61     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
62     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
63     at java.lang.Thread.run(Thread.java:748)
64 Caused by: org.springframework.web.socket.sockjs.SockJsTransportFailureException: WebSocket handshake failure; nested exception is java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to javax.websocket.server.ServerContainer
65     at org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler.handleRequest(WebSocketTransportHandler.java:127)
66     at org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService.handleTransportRequest(TransportHandlingSockJsService.java:312)
67     at org.springframework.web.socket.sockjs.support.AbstractSockJsService.handleRequest(AbstractSockJsService.java:433)
68     at org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler.handleRequest(SockJsHttpRequestHandler.java:132)
69     ... 55 more
70 Caused by: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to javax.websocket.server.ServerContainer
71     at org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy.getContainer(AbstractStandardUpgradeStrategy.java:67)
72     at org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer(TomcatRequestUpgradeStrategy.java:84)
73     at org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer(TomcatRequestUpgradeStrategy.java:47)
74     at org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy.getSupportedExtensions(AbstractStandardUpgradeStrategy.java:88)
75     at org.springframework.web.socket.server.support.AbstractHandshakeHandler.doHandshake(AbstractHandshakeHandler.java:272)
76     at org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler.handleRequest(WebSocketTransportHandler.java:123)
77     ... 58 more
78 21:09:52.177 [MessageBroker-4] INFO  c.t.s.s.impl.StockNewsServiceImpl - [2017-12-16 21:09:52] execute fetch stock news, result = 0

在stackflow上看到的解决方案:

https://samebug.io/exceptions/173734/java.lang.ClassCastException/orgapachetomcatwebsocketserverwsservercontainer

https://stackoverflow.com/questions/28348686/tomcat-8-and-websocket

Maven:

<dependency>
    <groupId>javax.websocket</groupId>
    <artifactId>javax.websocket-api</artifactId>
    <version>1.0</version>
    <scope>provided</scope>
</dependency>

Gradle:
providedCompile("javax.websocket:javax.websocket-api:1.1")
时间: 2024-10-09 14:38:25

ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to javax.websocket.server.ServerContainer的相关文章

org.apache.struts.taglib.bean.CookieTei cannot be cast to javax.servlet.jsp.tagext.TagExtraInfo

严重: Servlet.service() for servlet jsp threw exceptionjava.lang.ClassCastException: org.apache.struts.taglib.bean.CookieTei cannot be cast to javax.servlet.jsp.tagext.TagExtraInfo at org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibra

org.apache.cxf.transport.servlet.CXFServlet cannot be cast to javax.servlet.Servlet

java.lang.ClassCastException: org.apache.cxf.transport.servlet.CXFServlet cannot be cast to javax.servlet.Servlet maven下web项目依赖servlet-api.jar 1 <dependency> 2 <groupId>javax.servlet</groupId> 3 <artifactId>servlet-api</artifact

【原创】问题定位分享(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.hadoop.hive.hbase.HiveHBaseTableOutputFormat cannot be cast to org.apache.hadoop.hive.ql.io.HiveOutputFormat at org.apache.spark.sql.hive.SparkHiveWrit

How to Install Apache Tomcat 8.5 on CentOS 7.3

How to Install Apache Tomcat 8.5 on CentOS 7.3 From: https://www.howtoforge.com/tutorial/how-to-install-tomcat-on-centos/ This tutorial exists for these OS versions CentOS 7.3 CentOS 7 On this page Step 1 - Install Java (JRE and JDK) Step 2 - Configu

JRE System Library [jdk1.7]和Server Library [Apache Tomcat v6.0]为绑定错误解决方案

今天在用Myeclipse8.6导入一个Java Web工程时,包错,通过单击导入的文件工程名,点击属性(properties),查看Java Build Path,有如下信息:JRE System Library [jdk1.7](unbound)和Server Library [ApacheTomcat v6.0](unbound) JRE System Library[jdk1.7](unbound)系统JRE未绑定解决方案 eclipse导入项目报错 :Unboundclasspath

eclipse配置server没有Apache tomcat 7.0

eclipse配置server没有Apache tomcat 7.0 原因:eclipse中WTP版本太低了 解决方案: 换成高版本就有行了 eclipse配置server没有Apache tomcat 7.0,布布扣,bubuko.com

Server Library [Apache Tomcat 7.0] unbound解决方案

问题描述: 当在MyEclipse中导入高版本Eclipse的[Eclipse Dynamic Web]项目后,会发现其Java Build Path(选定项目->Alt+Enter即可打开Properties for MyApp)的Libraries中有一项显示:Server Library [Apache Tomcat 7.0] (unbound),即"未绑定",如下截图所示: 如此将造成:由于缺少Tomcat的jar包(jsp-api.jar.servlet-api.jar

启动tomcat java.lang.NoClassDefFoundError: javax/websocket/Endpoint

启动linux 中tomcat报错: May 15, 2017 10:52:11 AM org.apache.catalina.core.StandardContext listenerStop SEVERE: Exception sending context destroyed event to listener instance of class websocket.drawboard.DrawboardContextListener java.lang.NoClassDefFoundEr

访问不到主页index.jsp的原因是servlet-api.jar包有冲突,删除lib的servlet-api.jar,如果报错则添加Apache Tomcat下的 servlet-api.jar 即可。

HTTP Status 500 - Unable to compile class for JSP: type Exception report message Unable to compile class for JSP: description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperE