我需要你的帮助。 问题是:
<session-timeout>
结束java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407) at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:725) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760) at java.lang.Thread.run(Unknown Source)
喜欢它内部工作: 只有某些操作才能重现错误。 例如,此网址重现问题
localhost:8080/myapp/editPromotion?promoId=TestBes
而这个不是
localhost:8080/myapp/searchCustomerHome
拦截器对这些网址的工作方式相同
public String intercept(ActionInvocation invocation) throws Exception {
if (!isLoginAction(invocation)) {
Map<String, Object> sessionMap = ActionContext.getContext().getSession();
if (sessionMap.get(LoginAction.USER_NAME) == null) {
return "notAuthenticated";
}
}
return invocation.invoke();
}
并返回“notAuthenticated”。
另外我在struts.xml中有这段代码:
<global-results>
<result name="notAuthenticated" type="redirect">login</result>
</global-results>
唯一的差异错误请求转到
org.apache.struts2.interceptor.MessageStoreInterceptor.java
并开始运行
public String intercept(ActionInvocation invocation) throws Exception {
LOG.debug("entering MessageStoreInterceptor ...");
before(invocation);
String result = invocation.invoke();
after(invocation, result);
LOG.debug("exit executing MessageStoreInterceptor");
return result;
}
我不知道为什么他们的工作如此不同。
答案 0 :(得分:0)
我遇到了同样的问题 - 一切都很好,直到会话超时,取决于请求的操作,我会看到这个例外。
我通过添加&#34; createSession&#34;解决了这个问题。拦截器作为行动中的第一个拦截器,它解决了这个问题。