Uploaded image for project: 'MyFaces Orchestra'
  1. MyFaces Orchestra
  2. ORCHESTRA-18

Cannot get access-scoped beans from a servlet

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1
    • None
    • None
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            skitching Simon Kitching
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: