• java.lang.IllegalStateException: Cannot forward after response has been committe


    当发生在如下错误的时候,有一个方案可行,

    "java.lang.IllegalStateException: Cannot forward after response has been committed “

    当你有多个跳转的页面的语句时候,好好检查一下,当 转发 或者 重定向的时候,需要在后加一个retrun 即可。

    服务器中不允许多次跳转,否则会下面这个错误。

    因为服务器端使用sendRedirect跳转到客户端的时候,不能在使用req.getRequestDispatcher("跳转的页面").forward(req, reqs);

    跳转;

    所以在跳转之后,return就不会往下执行。


    严重: Servlet.service() for servlet [jsp] in context with path [/TomcatSecurityValidte] threw exception
    java.lang.IllegalStateException: Cannot forward after response has been committed
     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:339)
     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
     at com.pack.security.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:39)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:582)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:279)
     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
     at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
     at java.lang.Thread.run(Thread.java:619)


  • 相关阅读:
    Nios学习笔记3——流水灯实验
    Nios学习笔记2——流水灯实验
    Nios学习笔记1——流水灯实验
    转:摄像头camera 7660/7670/7225/9650以及程序流程(一)
    fpga 扇入扇出
    门控时钟的使用
    门控时钟与多扇出问题解决方案
    为所欲为——教你什么才是真正的任意分频
    SDRAM时序--读高手进阶,终极内存技术指南
    FPGA你必须知道的那些事儿
  • 原文地址:https://www.cnblogs.com/yangzhi/p/3576582.html
Copyright © 2020-2023  润新知