Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-1823

KualiHttpSessionListener sessionDestroyed method does not have valid UserSession in GlobalVariables

    Details

    • Type: Bug Fix Bug Fix
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.3-kra, 0.9.3
    • Component/s: Development
    • Labels:
      None
    • Similar issues:
      KULRICE-14210KualiHttpSessionListener releases wrong locks
      KULRICE-3654DateTimeServiceImpl.java parse method does not check for Valid Dates
      KULRICE-5341UserSession gets bound to a thread, and eDocLite documents are not establishing user session properly
      KULRICE-10110Cleanup on copy methods
      KULRICE-6130Document various "validate" methods on KimTypeService
      KULRICE-9940Cleanup from new copy methods
      KULRICE-7731Validation messages Get Warning+Info Messages does nothing or results in method POST not supported stacktrace
      KULRICE-7661AdHoc Group request - isAddHocRouteWorkgroupValid() method should validate the groups permission and it is not.
      KULRICE-12559Document controller is missing recall method
      KULRICE-12344Issue with IdentityArchiveServiceImpl when entity does not have principal
    • Rice Module:
      KNS
    • Application Requirement:
      Rice

      Description

      The sessionDestroyed() method in KualiHttpSessionListener makes a call to DocumentService to get a document using a document id but there is no valid UserSession in GlobalVariables so an error is thrown.

      Solution would be to simply get the UserSession from the destroyed session object passed in via the HttpSessionEvent object and set it in GlobalVariables.

      Original E-mail from Chitra:

      While I was implementing Session time out handling within KRA, I noticed the following.

      Within the sessionDestroyed method of KualiHttpSessionListener, we are attempting to release all existing locks for a specific document available in that Session. We are basically looking for a document key in session and if present, we go on to retrieve the document and proceed to release the locks. But DocumentService's getByDocumentHeaderId also depends on UserSession being present in GlonalVariables.

      When I was testing the Session timeout stuff in KRA, I found that there were two sessions being created and hence, I modified KualiCASFilter to get rid of the second session (KULRICE-1810). After this change, I started facing
      "GlobalVariables must be populated with a valid UserSession before a document can be fetched" at org.kuali.core.service.impl.DocumentServiceImpl.getByDocumentHeaderId(DocumentServiceImpl.java:483) during Session Expiration (lock cleanup code).

      So, I had to extend the KualiHttpSessionListener (within KRA) and override sessionDestroyed method.

      @Override
      public void sessionDestroyed(HttpSessionEvent se)

      { UserSession userSession = (UserSession) se.getSession().getAttribute(org.kuali.RiceConstants.USER_SESSION_KEY); GlobalVariables.setUserSession(userSession); super.sessionDestroyed(se); }

      With this change, things work fine.

      I just wanted to know if you could take a look at this and possibly include it within KualiHttpSessionListener.

        Activity

        Hide
        David Elyea added a comment -

        Solution was to follow e-mail suggestion from Chitra. I also null out the GlobalVariables user session object once the sessionDestroyed() method is complete.

        Show
        David Elyea added a comment - Solution was to follow e-mail suggestion from Chitra. I also null out the GlobalVariables user session object once the sessionDestroyed() method is complete.
        Hide
        David Elyea added a comment -

        Hey Chitra,

        Turns out new Rice jars were just created for KRA today and my change did make it in. Not sure when Bryan or Geoff are adding them to the codebase but once they do you should be able to remove your session listener class extension. Let me know if you see any problems.

        Show
        David Elyea added a comment - Hey Chitra, Turns out new Rice jars were just created for KRA today and my change did make it in. Not sure when Bryan or Geoff are adding them to the codebase but once they do you should be able to remove your session listener class extension. Let me know if you see any problems.

          People

          • Assignee:
            David Elyea
            Reporter:
            Chitra Chandran
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Structure Helper Panel