[ https://issues.apache.org/jira/browse/MYFACES-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16137267#comment-16137267 ]
Eduardo Breijo commented on MYFACES-4127: ----------------------------------------- I can provide a sample application for this issue. I think the issue here is that we are defining in the @FlowMap to be @ApplicationScoped (hence the wrong exception) when it should be @FlowScoped in the ApplicationScopeObjectProducer class. I tried to change the scope to be FlowScoped but I get this error message "The annotation @FlowScoped is disallowed for this location". I remember when I was working with MYFACES-4126, at first I tried to implement that in a different way, by implementing Bean<T>, which lets you define a scope for the object, and I think that worked as expected. It would be nice if there is a way to change the scope of that FlowMap with what we currently have. > Unexpected exception thrown when FlowMap is injected on a RequestScoped bean > ---------------------------------------------------------------------------- > > Key: MYFACES-4127 > URL: https://issues.apache.org/jira/browse/MYFACES-4127 > Project: MyFaces Core > Issue Type: Bug > Affects Versions: 2.3.0-beta > Reporter: Eduardo Breijo > Priority: Minor > Attachments: ConfigItems.java > > > When @FlowMap is injected on a RequestScoped bean, and you try to use that > object (which should be null since we are not inside of a flow), an > unexpected exception is thrown. This was noted after JIRA issue: > https://issues.apache.org/jira/browse/MYFACES-4126 > Caused by: org.jboss.weld.exceptions.IllegalProductException: WELD-000052: > Cannot return null from a non-dependent producer method: Producer for > Producer Method [Map<Object, Object>] with qualifiers [@FlowMap @Any] > declared as [[UnbackedAnnotatedMethod] @Produces @FlowMap @ApplicationScoped > public > org.apache.myfaces.cdi.faces.ApplicationScopeObjectProducer.getFlowMap()] > declared on Managed Bean [class > org.apache.myfaces.cdi.faces.ApplicationScopeObjectProducer] with qualifiers > [@Any @Default] > at > org.apache.myfaces.cdi.faces.ApplicationScopeObjectProducer.getFlowMap(ApplicationScopeObjectProducer.java:73) > StackTrace: > at > org.jboss.weld.bean.AbstractProducerBean.checkReturnValue(AbstractProducerBean.java:136) > at [internal classes] > at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96) > at > org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100) > at [internal classes] > at java.lang.String.valueOf(String.java:2994) > at java.lang.StringBuilder.append(StringBuilder.java:131) > at > com.ibm.ws.jsf23.fat.beans.ELImplicitObjectBean.execute(ELImplicitObjectBean.java:163) > On Mojarra 2.3, we get a different exception which looks more appropriate. > org.jboss.weld.contexts.ContextNotActiveException: WELD-001303: No active > contexts for scope type javax.faces.flow.FlowScoped > > org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:623) > > org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:89) > > org.jboss.weld.bean.ContextualInstance.getIfExists(ContextualInstance.java:63) > > org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:87) > > org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125) > > org.jboss.weld.util.Map$1302817811$Proxy$_$$_WeldClientProxy.toString(Unknown > Source) > java.lang.String.valueOf(String.java:2994) > java.lang.StringBuilder.append(StringBuilder.java:131) > > com.ibm.ws.jsf23.fat.beans.ELImplicitObjectBean.execute(ELImplicitObjectBean.java:163) -- This message was sent by Atlassian JIRA (v6.4.14#64029)