ERROR 18904 --- [nio-8080-exec-7] o.s.b.w.servlet.support.Er



我正在使用tomcat 9.0Springboot

错误22484---[io--8080-exec-58]o.s.b.w.servlet.support.ErrorPageFilter:无法转发到请求[/]的错误页面,因为响应已经提交。因此,响应可能具有错误的状态代码。如果您的应用程序在WebSphereApplicationServer上运行,您可以通过将com.ibm.ws.webcontainer.invokeFlushAfterService设置为false 来解决此问题

我试过的:

  • 创建@Bean@Beanpublic FilterRegistrationBean disableSpringBootErrorFilter(ErrorPageFilter筛选器({FilterRegistrationBean FilterRegistrationBean=新的FilterRegistration Bean((;filterRegistrationBean.setFilter(filter(;filterRegistrationBean.setEnabled(false(;return filterRegistrationBean;*

  • 在应用程序中添加了这些。属性

spring.main.allow-bean-definition-override:truelogging.level.org.springframework.boot.context.web.ErrorPageFilter=关闭

  • 在控制器中添加@ResponseBody

  • etc:清理项目,重新启动eclipse,

都没用!!

这是我的控制台日志

2022-03-15 20:17:03.099  INFO 18904 --- [           main] c.z.l.configuration.ServletInitializer   : Starting ServletInitializer v0.0.1-SNAPSHOT using Java 17.0.1 on DESKTOP-JBB51IM with PID 18904 (C:Usersuser1DesktopLMS_war2.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsLMSWEB-INFclasses started by user1 in C:WINDOWSsystem32)
2022-03-15 20:17:03.132  INFO 18904 --- [           main] c.z.l.configuration.ServletInitializer   : No active profile set, falling back to default profiles: default
2022-03-15 20:17:12.317  INFO 18904 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-03-15 20:17:13.004  INFO 18904 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 581 ms. Found 1 JPA repository interfaces.
2022-03-15 20:17:14.333  WARN 18904 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[com.zerobase.lms]' package. Please check your configuration.
2022-03-15 20:17:18.345  INFO 18904 --- [           main] o.a.c.c.C.[Catalina].[localhost].[/]     : Initializing Spring embedded WebApplicationContext
2022-03-15 20:17:18.345  INFO 18904 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 14282 ms
2022-03-15 20:17:19.975  INFO 18904 --- [           main] o.s.boot.web.servlet.RegistrationBean    : Filter springSecurityFilterChain was not registered (possibly already registered?)
2022-03-15 20:17:19.975  INFO 18904 --- [           main] o.s.boot.web.servlet.RegistrationBean    : Filter errorPageFilter was not registered (disabled)
2022-03-15 20:17:22.633  INFO 18904 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-03-15 20:17:23.470  INFO 18904 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.4.Final
2022-03-15 20:17:25.335  INFO 18904 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-03-15 20:17:26.743  INFO 18904 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-03-15 20:17:28.841  INFO 18904 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2022-03-15 20:17:30.180  INFO 18904 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2022-03-15 20:17:37.922  INFO 18904 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-03-15 20:17:38.019  INFO 18904 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-03-15 20:17:43.506  WARN 18904 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-03-15 20:17:46.716  INFO 18904 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@13879c47, org.springframework.security.web.context.SecurityContextPersistenceFilter@3af41750, org.springframework.security.web.header.HeaderWriterFilter@1ad779a6, org.springframework.security.web.authentication.logout.LogoutFilter@1937bcc6, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@59168cdc, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@38a5eb35, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@a4d4219, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@5a72fe51, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@178a0b1, org.springframework.security.web.session.SessionManagementFilter@1046987b, org.springframework.security.web.access.ExceptionTranslationFilter@288a7102, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@2cc9371f]
2022-03-15 20:17:49.844  INFO 18904 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page template: index
2022-03-15 20:17:53.758  INFO 18904 --- [           main] c.z.l.configuration.ServletInitializer   : Started ServletInitializer in 57.665 seconds (JVM running for 86.753)
2022-03-15 20:17:54.246  WARN 18904 --- [           main] o.a.c.util.SessionIdGeneratorBase        : [SHA1PRNG] 알고리즘을 사용하여, 세션 ID를 생성하기 위한 SecureRandom 객체를 생성하는데, [452] 밀리초가 소요됐습니다.
2022-03-15 20:17:54.406  INFO 18904 --- [           main] org.apache.catalina.startup.Catalina     : 서버가 [82204] 밀리초 내에 시작되었습니다.
2022-03-15 20:17:54.692  INFO 18904 --- [nio-8080-exec-1] o.a.c.c.C.[Catalina].[localhost].[/]     : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-03-15 20:17:54.693  INFO 18904 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2022-03-15 20:17:54.697  INFO 18904 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 3 ms
Hibernate: select member_ent0_.user_id as user_id1_0_0_, member_ent0_.authdt as authdt2_0_0_, member_ent0_.email_auth_key as email_au3_0_0_, member_ent0_.email_authyn as email_au4_0_0_, member_ent0_.password as password5_0_0_, member_ent0_.phone as phone6_0_0_, member_ent0_.reset_password_key as reset_pa7_0_0_, member_ent0_.user_name as user_nam8_0_0_ from member_entity member_ent0_ where member_ent0_.user_id=?
2022-03-15 20:19:48.020 ERROR 18904 --- [nio-8080-exec-7] o.s.b.w.servlet.support.ErrorPageFilter  : Cannot forward to error page for request [/admin/member/list.do] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false

有什么可能的方法来解决这个错误吗?感谢阅读。。。

我有两个控制器。。。并将其连接到一个控制器(还将其重命名为Getmappings。。。它奏效了。。我会在找到原因后尽快添加评论。谢谢!

从问题描述中,我可以理解的是,在出现异常/错误的情况下,您希望返回特定的响应。

在这种情况下,您可以使用@ControllerAdvice来捕获错误并返回您想要的特定响应。如果你需要任何帮助,那么我随时准备帮助你。

最新更新