org.apache.coyote.Request cannot be cast to org.apache.coyote.http11.upgrade.UpgradeInbound

java.lang.ClassCastException: org.apache.coyote.Request cannot be cast to org.apache.coyote.http11.upgrade.UpgradeInbound
at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:842)
at org.apache.coyote.Request.action(Request.java:344)
at org.apache.catalina.connector.Request.doUpgrade(Request.java:2813)
at org.apache.catalina.connector.RequestFacade.doUpgrade(RequestFacade.java:1103)
at org.apache.catalina.websocket.WebSocketServlet.doGet(WebSocketServlet.java:131)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)


使用websocket 莫名其妙遇到了上述错误:

调了半天发现是因为 在方法 
protected StreamInbound createWebSocketInbound(String arg0,HttpServletRequest arg1) ;

中返回了null

你可能感兴趣的:(org.apache.coyote.Request cannot be cast to org.apache.coyote.http11.upgrade.UpgradeInbound)