We run Struts 2.5.14.1 and work on an external Tomcat session. This requires Serializable sessions. However, our actions with the ExecuteAndWait interceptor are not performed. Since our original code was quite complex, I wrote a simpler example that demonstrates the same behavior.
Here's a simple action:
package com.sentrylink.web.actions;
import java.util.concurrent.TimeUnit;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import com.opensymphony.xwork2.ActionSupport;
@SuppressWarnings("serial")
@Results({
@Result(name="wait", location="/"),
@Result(name=ActionSupport.SUCCESS, location="/WEB-INF/content/messagePage.jsp"),
})
@InterceptorRefs({
@InterceptorRef("webStack"),
@InterceptorRef("execAndWait")
})
public class TestExecuteAndWait extends ActionSupport {
public String execute() throws Exception {
TimeUnit.SECONDS.sleep(10);
return SUCCESS;
}
}
Doing this gives
WARNING: Cannot serialize session attribute __execWaittest-execute-and-wait for session 74CDB9F8D00BBC697030AFC6978E94F6
java.io.NotSerializableException: com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector
It looks like Struts is pulling out an unwanted element for serialization. This may be due to the description of the error here , although the fix introduced for this error seems to be contained in 2.5.14.1 (not surprising since this fix was in 2013).
, , , , , - - ExecuteAndWait .