Spring boot 3.0.2 Отсутствует реализация разрешенного метода 'abstract void doFilterInternal(jakarta.*) абстрактного класса filter.OncePerRequestFilter
Я переношу приложение с Java 11 Spring Boot 2.7.0 на Java 17 Spring Boot 3.0.0, spring security 6.0.1 и получаю сообщение об ошибке:
ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[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.
u2028 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
u2028 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185)
u2028 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
u2028 at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
u2028 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
u2028 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185)
u2028 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
[http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Trying to match request against DefaultSecurityFilterChain [RequestMatcher=Mvc [pattern='/ets/v1/service', GET], Filters=[]] (1/2)
2023-02-15 08:16:30.949+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Trying to match request against DefaultSecurityFilterChain [RequestMatcher=any request, Filters=[org.springframework.security.web.session.DisableEncodeUrlFilter@5fa5d20d, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@4f7d5597, org.springframework.security.web.context.SecurityContextPersistenceFilter@5159969e, org.springframework.security.web.header.HeaderWriterFilter@543e126, org.springframework.security.web.authentication.logout.LogoutFilter@36b62ef1, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6a18bff6, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7e38440b, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@53649db8, org.springframework.security.web.session.SessionManagementFilter@1882d510, org.springframework.security.web.access.ExceptionTranslationFilter@6c3f4afc, org.springframework.security.web.access.intercept.AuthorizationFilter@17a16484]] (2/2)
2023-02-15 08:16:30.949+0530 [] [http-nio-8484-exec-1] DEBUG org.springframework.security.web.FilterChainProxy - Securing GET /error
2023-02-15 08:16:30.957+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking DisableEncodeUrlFilter (1/11)
2023-02-15 08:16:30.957+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking WebAsyncManagerIntegrationFilter (2/11)
2023-02-15 08:16:30.957+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking SecurityContextPersistenceFilter (3/11)
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.context.SupplierDeferredSecurityContext - Created SecurityContextImpl [Null authentication]
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] DEBUG org.springframework.security.web.context.SecurityContextPersistenceFilter - Set SecurityContextHolder to empty SecurityContext
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking HeaderWriterFilter (4/11)
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking LogoutFilter (5/11)
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.authentication.logout.LogoutFilter - Did not match request to Or [Ant [pattern='/logout', GET], Ant [pattern='/logout', POST], Ant [pattern='/logout', PUT], Ant [pattern='/logout', DELETE]]
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking RequestCacheAwareFilter (6/11)
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking SecurityContextHolderAwareRequestFilter (7/11)
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking AnonymousAuthenticationFilter (8/11)
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking SessionManagementFilter (9/11)
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.authentication.AnonymousAuthenticationFilter - Set SecurityContextHolder to AnonymousAuthenticationToken [Principal=anonymousUser, Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=0:0:0:0:0:0:0:1, SessionId=null], Granted Authorities=[ROLE_ANONYMOUS]]
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking ExceptionTranslationFilter (10/11)
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.FilterChainProxy - Invoking AuthorizationFilter (11/11)
2023-02-15 08:16:30.965+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.access.intercept.RequestMatcherDelegatingAuthorizationManager - Authorizing SecurityContextHolderAwareRequestWrapper[ FirewalledRequest[ org.apache.catalina.core.ApplicationHttpRequest@5210f6c4]]
2023-02-15 08:16:30.981+0530 [] [http-nio-8484-exec-1] TRACE org.springframework.security.web.access.intercept.RequestMatcherDelegatingAuthorizationManager - Checking authorization on SecurityContextHolderAwareRequestWrapper[ FirewalledRequest[ org.apache.catalina.core.ApplicationHttpRequest@5210f6c4]] using org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer$$Lambda$1777/0x000000080195a478@123eb472
2023-02-15 08:16:30.981+0530 [] [http-nio-8484-exec-1] DEBUG org.springframework.security.web.FilterChainProxy - Secured GET /error
2023-02-15 08:16:31.037+0530 [] [http-nio-8484-exec-1] DEBUG org.springframework.security.web.context.SecurityContextPersistenceFilter - Cleared SecurityContextHolder to complete request
2023-02-15 08:16:31.680+0530 [] [http-nio-8484-exec-2] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[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.
Ошибка выше, которую я получаю при вызове API
Обновил мою версию Java до 17. и изменил весь импорт на пакет jakarta.*.
Вот моя конфигурация безопасности:
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeHttpRequests((requests) -> requests
.requestMatchers("/docs/*", "/WEB-INF/jsp/*", "/leap/**", "/leap/login.css", "/leap/css/**", "/leap/js/sign-up/**",
"/leap/font-awesome-4.7.0/css/**", "/leap/assets/**", "/leap/js/**",
"/leap/jquery/3.2.1/**", "/leap/font-google-open-sans-v14/**").permitAll()
.requestMatchers(HttpMethod.GET, ControllerMappings.SERVICE, "/", "/WEB-INF/jsp/sign-up/.*(\\?.*)?", "/error").permitAll()
.anyRequest().authenticated()
)
.securityContext((securityContext) ->
securityContext.requireExplicitSave(false)
);
return http.build();
}