java.lang.AbstractMethodError: Missing implementation of resolved method 'abstract void doFilterInternal(..)

huangapple go评论81阅读模式
英文:

java.lang.AbstractMethodError: Missing implementation of resolved method 'abstract void doFilterInternal(..)

问题

我正在从Spring Boot 2.1.11_RELEASE升级到3.0.6版本。但在我的本地环境中访问特定API时,我遇到了以下错误:

ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - 在路径 [] 的上下文中的servlet [dispatcherServlet] 抛出了异常 [Filter执行引发了异常],原因是

java.lang.AbstractMethodError: 未找到抽象类org.springframework.web.filter.OncePerRequestFilter的已解析方法 'abstract void doFilterInternal(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)' 的实现。
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	...

当我在开发环境中访问API时,出现以下错误:

java.lang.AbstractMethodError: 接收类com.xxx.xxx.api.util.AllowLoggedInUserFilter未定义或继承了抽象类org.springframework.web.filter.OncePerRequestFilter的已解析方法 'abstract void doFilterInternal(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)' 的实现。

我已经对其他具有类似代码的服务执行了相同的升级操作,但没有遇到错误,包括从javax迁移到jakarta。这是一个特别旧的服务。
这个stackoverflow上的问题没有解决我的问题。

更新
在一个名为AllowLoggedInUserFilter的共享库中使用了javax,在应用程序配置中使用它导致了问题。由于我现在无法将AllowLoggedInUserFilter更新为使用jakarta,所以我创建了一个使用jakarta的它的副本来解决问题。

英文:

I am upgrading from spring boot 2.1.11_RELEASE to 3.0.6. But on hitting a particular api, I get this error on my local :

ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Filter execution threw an exception] with root cause

java.lang.AbstractMethodError: Missing implementation of resolved method 'abstract void doFilterInternal(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)' of abstract class org.springframework.web.filter.OncePerRequestFilter.
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at com.xxx.xxx.xxx.filter.RequestIdentifierFilter.doFilterInternal(RequestIdentifierFilter.java:52)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:166)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:676)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:894)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:833)
> 0:0:0:0:0:0:0:1 - - [05/Jun/2023:16:06:35 +0530] 'GET /wallet-service/ve2/wallet/balance HTTP/1.1' 500 929 69440 '-' '-' '-'

and this error when I hit the api on dev env:

java.lang.AbstractMethodError: Receiver class com.xxx.xxx.api.util.AllowLoggedInUserFilter does not define or inherit an implementation of the resolved method 'abstract void doFilterInternal(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)' of abstract class org.springframework.web.filter.OncePerRequestFilter.

I have done the same upgradation with other services with similar code but has faced no errors including migrating from javax to jakarta.
This one is a particularly old service.
This question on stackoverflow doesn't solve my issue.

UPDATE
javax was being used in another class AllowLoggedInUserFilter from a common library which was being used in app configurations causing the issue. Since, I can't update AllowLoggedInUserFilter to jakarta right now I created my own replica of it using jakarta in service.

答案1

得分: 0

如xerx593所提到的,javax在另一个名为AllowLoggedInUserFilter的通用库中被用于应用配置,导致了问题。由于我现在无法将AllowLoggedInUserFilter更新为jakarta,因此我在服务中创建了一个使用jakarta的自己的副本。

英文:

as mentioned by xerx593, javax was being used in another class AllowLoggedInUserFilter from a common library which was being used in app configurations causing the issue. Since, I can't update AllowLoggedInUserFilter to jakarta right now I created my own replica of it using jakarta in service.

huangapple
  • 本文由 发表于 2023年6月5日 19:03:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76405790.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定