Cannot get access-scoped beans from a servlet
---------------------------------------------

                 Key: ORCHESTRA-18
                 URL: https://issues.apache.org/jira/browse/ORCHESTRA-18
             Project: MyFaces Orchestra
          Issue Type: Bug
    Affects Versions: 1.1
            Reporter: Simon Kitching


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to