ClassCastException:org.apache.tomcat.websocket.server.WsServerContainer cannot is cast to Javax.websocket.server.ServerContainer

Source: Internet
Author: User

121:09:22.221 [MessageBroker-3] INFO C.t.s.s.impl.stocknewsserviceimpl-[2017-12-16 21:09:22] Execute fetch stock news, R Esult = 0221:09:32.158 [MessageBroker-2] INFO C.t.s.s.impl.stocknewsserviceimpl-[2017-12-16 21:09:32] Execute fetch stock news, R Esult = 0321:09:42.180 [MessageBroker-2] INFO C.t.s.s.impl.stocknewsserviceimpl-[2017-12-16 21:09:42] Execute fetch stock news, R Esult = 04Org.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.ServerContainer5At Org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler.handleRequest ( sockjshttprequesthandler.java:135)6At Org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle (httprequesthandleradapter.java:51)7At Org.springframework.web.servlet.DispatcherServlet.doDispatch (dispatcherservlet.java:967)8At Org.springframework.web.servlet.DispatcherServlet.doService (dispatcherservlet.java:901)9At Org.springframework.web.servlet.FrameworkServlet.processRequest (frameworkservlet.java:970)TenAt Org.springframework.web.servlet.FrameworkServlet.doGet (frameworkservlet.java:861) OneAt Javax.servlet.http.HttpServlet.service (httpservlet.java:624) AAt Org.springframework.web.servlet.FrameworkServlet.service (frameworkservlet.java:846) -At Javax.servlet.http.HttpServlet.service (httpservlet.java:731) -At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:303) theAt Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208) -At Org.apache.tomcat.websocket.server.WsFilter.doFilter (wsfilter.java:52) -At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241) -At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208) +At Org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter (Resourceurlencodingfilter.java : 59) -At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241) +At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208) AAt Org.springframework.web.filter.RequestContextFilter.doFilterInternal (requestcontextfilter.java:99) atAt Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107) -At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241) -At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208) -At Org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal (httpputformcontentfilter.java:108) -At Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107) -At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241) inAt Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208) -At Org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal (hiddenhttpmethodfilter.java:81) toAt Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107) +At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241) -At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208) theAt Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (characterencodingfilter.java:197) *At Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107) $At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241)Panax NotoginsengAt Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208) -At Org.springframework.boot.web.support.ErrorPageFilter.doFilter (errorpagefilter.java:115) theAt org.springframework.boot.web.support.errorpagefilter.access$000 (errorpagefilter.java:59) +At Org.springframework.boot.web.support.errorpagefilter$1.dofilterinternal (errorpagefilter.java:90) AException Start ********************** theAt Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107) +At Org.springframework.boot.web.support.ErrorPageFilter.doFilter (errorpagefilter.java:108) -Abnormal End ********************** $  $At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241) -At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208) -At Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:218) theAt Org.apache.catalina.core.StandardContextValve.invoke (standardcontextvalve.java:110) -At Org.apache.catalina.authenticator.AuthenticatorBase.invoke (authenticatorbase.java:506)WuyiAt Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:169) theAt Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:103) -At Org.apache.catalina.valves.AccessLogValve.invoke (accesslogvalve.java:962) WuAt Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:116) -At Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:445) AboutAt Org.apache.coyote.http11.AbstractHttp11Processor.process (abstracthttp11processor.java:1115) $At Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (abstractprotocol.java:637) -At Org.apache.tomcat.util.net.aprendpoint$socketprocessor.dorun (aprendpoint.java:2549) -At Org.apache.tomcat.util.net.aprendpoint$socketprocessor.run (aprendpoint.java:2538) -At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1142) AAt Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:617) +At Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (taskthread.java:61) theAt Java.lang.Thread.run (thread.java:748) - 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 $At Org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler.handleRequest ( websockettransporthandler.java:127) theAt Org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService.handleTransportRequest ( transporthandlingsockjsservice.java:312) theAt Org.springframework.web.socket.sockjs.support.AbstractSockJsService.handleRequest (Abstractsockjsservice.java : 433) theAt Org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler.handleRequest ( sockjshttprequesthandler.java:132) the... 55 More - caused By:java.lang.ClassCastException:org.apache.tomcat.websocket.server.WsServerContainer cannot is cast to Javax.websocket.server.ServerContainer inAt Org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy.getContainer ( abstractstandardupgradestrategy.java:67) theAt Org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer ( tomcatrequestupgradestrategy.java:84) theAt Org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer ( Tomcatrequestupgradestrategy.java:47) AboutAt Org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy.getSupportedExtensions ( abstractstandardupgradestrategy.java:88) theAt Org.springframework.web.socket.server.support.AbstractHandshakeHandler.doHandshake ( abstracthandshakehandler.java:272) theAt Org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler.handleRequest ( Websockettransporthandler.java:123) the... 58 More +21:09:52.177 [MessageBroker-4] INFO C.t.s.s.impl.stocknewsserviceimpl-[2017-12-16 21:09:52] Execute fetch stock news, R Esult = 0

Solutions seen on 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")

ClassCastException:org.apache.tomcat.websocket.server.WsServerContainer cannot is cast to Javax.websocket.server.ServerContainer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.