项目

一般

简介

部署项目访问报org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to org.glassfish.tyrus.server.TyrusServerContainer

由 吕 鹏钦 在 大约 3 年 之前添加

问题描述:

javax.servlet.ServletException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to org.glassfish.tyrus.server.TyrusServerContainer
    at com.apusic.web.container.WebComponent.create(WebComponent.java:284)
    at com.apusic.web.container.WebComponent.getComponent(WebComponent.java:158)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:64)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:84)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:105)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.WebContainer.invoke(WebContainer.java:1166)
    at com.apusic.web.container.WebContainer.doProcessRequest(WebContainer.java:947)
    at com.apusic.web.container.WebContainer.processRequest(WebContainer.java:809)
    at com.apusic.web.http.VirtualHost.processRequest(VirtualHost.java:370)
    at com.apusic.web.http.HttpServer.processRequest(HttpServer.java:317)
    at com.apusic.web.http.HttpConnectionHandler.service(HttpConnectionHandler.java:26)
    at com.apusic.web.http.ConnectionHandler.processRequest(ConnectionHandler.java:360)
    at com.apusic.web.http.ConnectionHandler.processConnection(ConnectionHandler.java:138)
    at com.apusic.web.http.ConnectionHandler.run(ConnectionHandler.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to org.glassfish.tyrus.server.TyrusServerContainer
    at org.glassfish.tyrus.servlet.TyrusServletFilter.init(TyrusServletFilter.java:117)
    at com.apusic.web.container.FilterComponent.initializeComponent(FilterComponent.java:41)
    at com.apusic.web.container.FilterComponent.initializeComponent(FilterComponent.java:21)
    at com.apusic.web.container.WebComponent.create(WebComponent.java:276)
    ... 80 common frames omitted

 

 

解决方法:检查应用的WEB-INF目录下面的lib目录发现还有tomcat以来没有去除,去除之后访问即可。