有时,我的struts 2应用程序会抛出此异常。 我想要的时候无法复制它,它只是随机弹出。
Struts has detected an unhandled exception:
Messages:
Action has already executed
File: com/opensymphony/xwork2/DefaultActionInvocation.java
Line number: 240
Stacktraces
java.lang.IllegalStateException: Action has already executed
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:240)
xxx.yyy.zzz.qqq.ddd.interceptors.AuthInterceptor.invoke(AuthInterceptor.java:68)
xxx.yyy.zzz.qqq.ddd.interceptors.AuthCCareInterceptor.checkAuthenticateInvoke(AuthCCareInterceptor.java:142)
xxx.yyy.zzz.qqq.ddd.interceptors.AuthInterceptor.intercept(AuthInterceptor.java:59)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:498)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
对不起“xxx.yyy.zzz.qqq.ddd”,但它是机密信息。我相信你明白了!
谢谢: - )
答案 0 :(得分:5)
问题是我们在拦截器中保存变量,例如调用的动作实例。重构后,一切都开始正常工作!
拦截器需要是线程安全的(比如servlet)。
答案 1 :(得分:3)
这三个拦截器中的一个很可能被打破:
interceptors.AuthInterceptor.invoke(AuthInterceptor.java:68)
interceptors.AuthCCareInterceptor.checkAuthenticateInvoke(AuthCCareInterceptor.java:142)
interceptors.AuthInterceptor.intercept(AuthInterceptor.java:59)
显然,除了提供的信息之外,你无法告诉你更多信息。