i'm using tomcat 9.0 Springboot
ERROR 22484 --- [io-8080-exec-58] o.s.b.w.servlet.support.ErrorPageFilter : Cannot forward to error page for request [/] 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
what i tried:
create @Bean @Bean public FilterRegistrationBean disableSpringBootErrorFilter(ErrorPageFilter filter) { FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); filterRegistrationBean.setFilter(filter); filterRegistrationBean.setEnabled(false); return filterRegistrationBean;*
added these in application.properties
spring.main.allow-bean-definition-overriding: true logging.level.org.springframework.boot.context.web.ErrorPageFilter=off
add @ResponseBody in Controller
etc: clean project, restart eclipse,
all didn't work!!
this is my console log
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:\Users\user1\Desktop\LMS_war2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\LMS\WEB-INF\classes started by user1 in C:\WINDOWS\system32)
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
is there any possible ways to solve this error? thanks for reading...
CodePudding user response:
I had two controllers... and made it to one controller (and also renamed Getmappings... it worked.. I will add comments as soon as I find the reason. thankyou!
CodePudding user response:
From the problem description, what I can understand is that you want to return a specific response in the case of an exception/error.
In this case, you can use @ControllerAdvice and catch the error and return the specific response you want. If you want any help with this then I am ready to help you.