MyFaces Orchestra
  1. MyFaces Orchestra
  2. ORCHESTRA-18

Cannot get access-scoped beans from a servlet

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      As reported by Stephan Frai:

      A servlet does this:

      ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
      PwdForgottenJSF pwdForgottenBean = (PwdForgottenJSF) appContext.getBean("pwdForgottenJSF");

      web.xml is set up to correctly map a BasicFrameworkAdapter to the current request.

      But when pwdForgottenJSF is access-scoped, then this occurs:

      SCHWERWIEGEND: Servlet.service() for servlet ControllerServlet threw exception
      java.lang.IllegalArgumentException: No AccessScopeManager found.
      at ...conversation.AccessScopeManager.getInstance(AccessScopeManager.java:97)
      at ...conversation.ConversationAccessLifetimeAspect.markAsAccessed(ConversationAccessLifetimeAspect.java:35)
      at ...conversation.spring.SpringConversationScope.notifyAccessConversation(SpringConversationScope.java:194)
      at ....conversation.spring.AbstractSpringOrchestraScope.getRealBean(AbstractSpringOrchestraScope.java:333)

      The problem is that the AccessScopeManager.getInstance method calls frameworkAdapter.getBean(....), but a BasicFrameworkAdapter has no knowledge of Spring; it just looks up request/session/application scopes.

      A possible workaround is for the servlet to manually fetch the AccessScopeManager instance and store it in the request scope.

        Activity

        Hide
        Simon Kitching added a comment -

        Fixed in trunk, will be in the 1.2 release.

        Show
        Simon Kitching added a comment - Fixed in trunk, will be in the 1.2 release.
        Hide
        Simon Kitching added a comment -

        This issue should be fixed by the new SpringBasicFrameworkAdapter class available in Orchestra trunk (which will be in Orchestra 1.2).

        Show
        Simon Kitching added a comment - This issue should be fixed by the new SpringBasicFrameworkAdapter class available in Orchestra trunk (which will be in Orchestra 1.2).

          People

          • Assignee:
            Unassigned
            Reporter:
            Simon Kitching
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development