我有一个弹簧应用程序。长时间运行的服务调用(缓存加载过程大约需要1小时)在进程完成之前返回此错误。
例外
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: setAttribute: Session [C8CC93C497AE8AD1278FF844277C021D] has already been invalidated
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
根本原因
java.lang.IllegalStateException: setAttribute: Session [C8CC93C497AE8AD1278FF844277C021D] has already been invalidated
org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1452)
org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1417)
org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:156)
com.pearson.ltg.qmo.dashboard.web.controller.EhcacheRefreshController.loadData(EhcacheRefreshController.java:127)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)