1

プロジェクトではSpring Frameworkを使用しています。アプリケーションがタイムアウトすると、以下のエラーが発生します。このエラーが発生したときにログインページにリダイレクトするにはどうすればよいですか? このエラーのアプリケーション コンテキストを構成できますか?

PS .: Spring-Security は使用しません

 org.springframework.web.HttpSessionRequiredException : Expected session
    attribute 'UserPrinciple'
          at
    org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:103)
          at
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:614)
          at
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
          at
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
          at
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
          at
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
          at
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
          at
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
          at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
          at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
          at
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
          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:222)
          at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
          at
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
          at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
          at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
          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:407)
          at
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
          at org.apache.coyote.AbstractProtocol
    $AbstractConnectionHandler.process(AbstractProtocol.java:585)
          at org.apache.tomcat.util.net.JIoEndpoint
    $SocketProcessor.run(JIoEndpoint.java:310)
          at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
          at java.util.concurrent.ThreadPoolExecutor
    $Worker.run(ThreadPoolExecutor.java:603)
          at java.lang.Thread.run(Thread.java:722)
4

1 に答える 1

0

これはあなたを助けるかもしれません..

<error-page>
        <exception-type>org.springframework.web.HttpSessionRequiredException</exception-type>
        <location>/login.jsp</location>
</error-page> 
于 2013-03-27T13:53:23.930 に答える