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

MessageStoreInterceptor java.lang.IllegalStateException if there is no session

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.14.3
    • Fix Version/s: 2.3.28, 2.5
    • Component/s: Core Interceptors
    • Labels:
      None

      Description

      When there is no session the following error happens on

      <result type="redirect">

      .

      [org.apache.struts2.dispatcher.Dispatcher.error:38] []  - Exception occurred during processing request: Cannot create a session after the response has been committed
      java.lang.IllegalStateException: Cannot create a session after the response has been committed
              at org.apache.catalina.connector.Request.doGetSession(Request.java:2880) ~[catalina.jar:7.0.37]
              at org.apache.catalina.connector.Request.getSession(Request.java:2315) ~[catalina.jar:7.0.37]
              at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898) ~[catalina.jar:7.0.37]
              at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) ~[servlet-api.jar:na]
              at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) ~[servlet-api.jar:na]
              at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) ~[servlet-api.jar:na]
              at org.apache.struts2.dispatcher.SessionMap.put(SessionMap.java:177) ~[struts2-core-2.3.14.3.jar:2.3.14.3]
              at org.apache.struts2.interceptor.MessageStoreInterceptor.after(MessageStoreInterceptor.java:279) ~[struts2-core-2.3.14.3.jar:2.3.14.3]
              at org.apache.struts2.interceptor.MessageStoreInterceptor.intercept(MessageStoreInterceptor.java:195) ~[struts2-core-2.3.14.3.jar:2.3.14.3]
              at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) ~[xwork-core-2.3.14.3.jar:2.3.14.3]
      

      This always happens if you wget your resource that has redirect.

      The interceptor should check if the session is available and only then perform message storing.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jcustovic Jan Čustović
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: