Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4900

NotSerializableException: com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector when using ExecuteAndWait interceptor

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.14.1
    • Fix Version/s: 2.5.16
    • Component/s: None
    • Labels:
      None

      Description

      We are running Struts 2.5.14.1 and working on externalizing Tomcat session state. This requires Serializable sessions. However, our Action with the ExecuteAndWait interceptor fails. Since our original code was quite complex I wrote a simpler one below which demonstrates the exact same behavior.

      The simple action is shown here:

      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;
          }
      }
      

      Running this gives

      WARNING: Cannot serialize session attribute __execWaittest-execute-and-wait for session 74CDB9F8D00BBC697030AFC6978E94F6 
      java.io.NotSerializableException: com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector
      

      Removing the ExecuteAndWait interceptor fixes the issue.

      According to Yasser Zamani in WW-4873 : I reviewed ExecuteAndWaitInterceptor and seems has this bug when session goes to being serialized in middle of an background process.

        Attachments

          Activity

            People

            • Assignee:
              yasser.zamani Yasser Zamani
              Reporter:
              ekane Erica Kane
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: