Tomcat 重启会引发关于缺少 destroy() 方法的错误 [英] Tomcat restart throws error regarding the missing destroy() method
问题描述
我的服务部署在tomcat上.最近我们把tomcat升级到了9.0.43.并且当服务重启时(tomcat是作为服务安装在windows上的),抛出如下错误:
My service is deployed on tomcat. Recently we upgraded the tomcat to 9.0.43. And when the service is restarted (tomcat is installed on windows as a service), it throws the following error:
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,现在丢失了.
I looked into and find the root cause. Earlier there was a destroy method implementation in tomcat-websocket.jar in the WsFilter.class under lib\tomcat-websocket\org\apache\tomcat\websocket\server\WsFilter.class, which is now missing.
我现在该如何进行?有什么想法吗?
推荐答案
自 Servlet 4.0 API 以来,Filter
接口有默认实现.检查您是否没有在应用程序中部署另一个(和更旧的)javax.servlet-api.jar
.
Since Servlet 4.0 API the init
and close
methods of the Filter
interface have default implementations. Check if you are not deploying another (and older) javax.servlet-api.jar
with your application.
这篇关于Tomcat 重启会引发关于缺少 destroy() 方法的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!