[ 
https://issues.apache.org/jira/browse/DELTASPIKE-830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gerhard Petracek reopened DELTASPIKE-830:
-----------------------------------------

> Now active ViewAccessScoped context during restore view phase
> -------------------------------------------------------------
>
>                 Key: DELTASPIKE-830
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-830
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: JSF-Module
>    Affects Versions: 1.2.1
>         Environment: Glassfish 3.1.2.2 and Weblogic 12.1.2.2
>            Reporter: Nuno G. de M
>            Assignee: Thomas Andraschko
>             Fix For: 1.4.2
>
>
> While testing delta-spike in clientview mode, coming from CODI, we have one 
> view that is giving problems trying to access ViewAccessScoped beans  during 
> the restored view phase.
> Caused by: org.jboss.weld.context.ContextNotActiveException: WELD-001303 No 
> active contexts for scope type 
> org.apache.deltaspike.core.api.scope.ViewAccessScoped
> Namely the exception we get in our page is the following:
> Caused By: org.jboss.weld.context.ContextNotActiveException: WELD-001303 No 
> active contexts for scope type 
> org.apache.deltaspike.core.api.scope.ViewAccessScoped
>       at 
> org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:590)
>       at 
> org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:71)
>       at 
> org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
>       at 
> com.corp.whatever.component.ui.web.CR100Bean$Proxy$_$$_WeldClientProxy.getPageIds(CR100Bean$Proxy$_$$_WeldClientProxy.java)
>       at sun.reflect.GeneratedMethodAccessor1663.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at javax.el.BeanELResolver.getValue(BeanELResolver.java:305)
>       at 
> com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
>       at 
> com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
>       at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
>       at com.sun.el.parser.AstValue.getValue(AstValue.java:183)
>       at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
>       at 
> org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
>       at 
> org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
>       at 
> com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
>       at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:99)
>       at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
>       at 
> org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
>       at 
> org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
>       at 
> com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
>       at 
> com.sun.faces.facelets.tag.jstl.core.SetHandler.apply(SetHandler.java:163)
>       at 
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
>       at 
> javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
>       at 
> com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187)
>       at 
> javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
>       at 
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
>       at 
> com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:188)
>       at 
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
>       at 
> com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
>       at 
> com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
>       at 
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:320)
>       at 
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:379)
>       at 
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:358)
>       at 
> com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
>       at 
> com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
>       at 
> com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
>       at 
> com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
>       at 
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:320)
>       at 
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:379)
>       at 
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:358)
>       at 
> com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
>       at 
> com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
>       at 
> com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
>       at 
> com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
>       at 
> com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:164)
>       at 
> com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:914)
>       at 
> com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:571)
>       at 
> com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142)
>       at 
> javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:301)
>       at 
> javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:301)
>       at 
> com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
> ------------------
> -- In glassfish 3.1.2
> -------------
> we can see that exception takes place  here:
>     /**
>      * Gets an active context of the given scope. Throws an exception if there
>      * are no active contexts found or if there are too many matches
>      *
>      * @param scopeType The scope to match
>      * @return A single active context of the given scope
>      * @see 
> javax.enterprise.inject.spi.BeanManager#getContext(java.lang.Class)
>      */
>     public Context getContext(Class<? extends Annotation> scopeType) {
>         Context activeContext = null;
>         final List<Context> ctx = contexts.get(scopeType);
>         if (ctx == null) {
>             //this happens if no context is registered
>             throw new ContextNotActiveException(CONTEXT_NOT_ACTIVE, 
> scopeType.getName());
>         }
>         for (Context context : ctx) {
>             if (context.isActive()) {
>                 if (activeContext == null) {
>                     activeContext = context;
>                 } else {
>                     throw new 
> IllegalStateException(DUPLICATE_ACTIVE_CONTEXTS, scopeType.getName());
>                 }
>             }
>         }
>         if (activeContext == null) {
>             throw new ContextNotActiveException(CONTEXT_NOT_ACTIVE, 
> scopeType.getName());
>         }
>         return activeContext;
>     }
> Where the Context Appears to exist but no be active.
> Also the bean that is reported as not being active, when we navigate out of 
> hte view, we can see it being destoryed in a @preDestroy call. 
> I have created a sample application that tries as best as possible to 
> reproduce the sitatution we experience.
> Is there a way by which I could upload a small maven project for this?
> I am adding it to my google drive for the moment.
> https://drive.google.com/file/d/0B_dEiNBGUsxqQWRzVVRJT0RlU0E/view?usp=sharing
> In th sample project a tiny index.xhtml exists. Access it for example under:
> http://schb7mw7321:8080/jsf-viewaccessscoped/index.xhtml?dsrid=933&dswid=ViewerWindow
> If your port is configured to be 8080 (glassfish defaults or 7001 in 
> weblogic).
> The page will then display several tabs using a prime faces ui component.
> The first time a TAB is clicked, the UI processes the action without problems.
> The second time a tab is clicked JSF complains that it cannot access the bean 
> because its context is not active.
> The sample project is an imperfect reproduction of our real case scenario, 
> since in this case the exception is taking place during the apply request 
> values phase as opposed to on the restore view phase:
> Here is an example of stack trace from this sample app.
> 2015-02-04 22:41:11.460 WARNING  55 /index.xhtml @45,83 
> rendered="#{cr100.selectedTab eq 'default'}": 
> org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active 
> contexts for scope type org.apache.deltaspike.core.api.scope.ViewAccessScoped 
> (javax.enterprise.resource.webcontainer.jsf.lifecycle) 
> javax.el.ELException: /index.xhtml @45,83 rendered="#{cr100.selectedTab eq 
> 'default'}": org.jboss.weld.context.ContextNotActiveException: WELD-001303 No 
> active contexts for scope type 
> org.apache.deltaspike.core.api.scope.ViewAccessScoped
>       at 
> com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
>       at 
> javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
>       at 
> javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:415)
>       at 
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1168)
>       at org.primefaces.component.panel.Panel.processDecodes(Panel.java:290)
>       at javax.faces.component.UIForm.processDecodes(UIForm.java:225)
>       at 
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1178)
>       at 
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1178)
>       at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:925)
>       at 
> com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
>       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
>       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
>       at 
> org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeLifecycleWrapper.execute(DeltaSpikeLifecycleWrapper.java:89)
>       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
>       at 
> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
>       at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
>       at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>       at 
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
>       at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
>       at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
>       at 
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
>       at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
>       at 
> com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
>       at 
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
>       at 
> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
>       at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
>       at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
>       at 
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
>       at 
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>       at 
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>       at 
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>       at 
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>       at 
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>       at 
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>       at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>       at 
> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>       at 
> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: org.jboss.weld.context.ContextNotActiveException: WELD-001303 No 
> active contexts for scope type 
> org.apache.deltaspike.core.api.scope.ViewAccessScoped
>       at 
> org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:619)
>       at 
> org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:71)
>       at 
> org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
>       at 
> org.jboss.weld.proxies.ViewAccessedBean$Proxy$_$$_WeldClientProxy.getSelectedTab(ViewAccessedBean$Proxy$_$$_WeldClientProxy.java)
>       at sun.reflect.GeneratedMethodAccessor876.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at javax.el.BeanELResolver.getValue(BeanELResolver.java:363)
>       at 
> com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
>       at 
> com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
>       at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
>       at com.sun.el.parser.AstValue.getValue(AstValue.java:183)
>       at com.sun.el.parser.AstEqual.getValue(AstEqual.java:58)
>       at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
>       at 
> org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
>       at 
> com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
> Many thanks for the help.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to