Tomcat 重启抛出关于缺少 destroy() 方法的错误

Tomcat restart throws error regarding the missing destroy() method

我的服务部署在 tomcat。最近我们将 tomcat 升级到 9.0.43。当服务重新启动时(tomcat 作为服务安装在 windows 上),它会抛出以下错误:

SEVERE [Thread-19] org.apache.catalina.core.ApplicationFilterConfig.release Failed to destroy the filter named [Tomcat WebSocket (JSR356) Filter] of type [org.apache.tomcat.websocket.server.WsFilter]
    java.lang.AbstractMethodError: Receiver class org.apache.tomcat.websocket.server.WsFilter does not define or inherit an implementation of the resolved method abstract destroy()V of interface javax.servlet.Filter.
        at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:301)

我调查并找到了根本原因。之前在WsFilter.class下的tomcat-websocket.jar中有一个destroy方法实现 lib\tomcat-websocket\org\apache\tomcat\websocket\server\WsFilter.class,现在不见了。

我现在该怎么办?有什么想法吗?

自 Servlet 4.0 API 以来,Filter 接口的 initclose 方法具有默认实现。检查您是否没有为您的应用程序部署另一个(和更旧的)javax.servlet-api.jar