[ 
https://issues.apache.org/jira/browse/MYFACES-2979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12934293#action_12934293
 ] 

Jan-Kees van Andel commented on MYFACES-2979:
---------------------------------------------

IMHO, that would be an unwanted side effect of the PhaseListener.

I'm not sure what the spec says about this (I guess nothing), but recreating a 
session within the same request that invalidated it, would be pretty bad 
behavior if you ask me...

The annoying bit is, if we choose to add a check in the PhaseListener, there 
might be other checks we need to add there.

I suggest to fix it in the PhaseListener, to keep it as much side-effect-free 
as possible.

> Session invalidation in Development Stage causes error in OpenWebBeans
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2979
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2979
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.3-SNAPSHOT
>         Environment: MyFaces 2.0.3-SNAPSHOT in Dev mode, OpenWebBeans 1.0.0, 
> Tomcat 6.0.29 (with Glassfish EL 2.2)
>            Reporter: Jan-Kees van Andel
>
> I have a logout method, shown below:
>     public String logout() {
>         final FacesContext fc = FacesContext.getCurrentInstance();
>         final ExternalContext externalContext = fc.getExternalContext();
>         try {
>             externalContext.invalidateSession();
>             externalContext.redirect("http://www.google.nl";);
>         } catch (IOException e) {
>             log.error("Error redirecting after logout", e);
>         } finally {
>             fc.responseComplete();
>         }
>         return null;
>     }
> When I invoke this method, I get the following Exception from OpenWebBeans:
> javax.enterprise.context.ContextNotActiveException: WebBeans context with 
> scope type annotation @SessionScoped does not exist within current thread
>       at 
> org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:309)
>       at 
> org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:124)
>       at 
> org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:95)
>       at 
> org.apache.myfaces.examples.ebanking.web.bean.SessionBean_$$_javassist_2.getCustomer(SessionBean_$$_javassist_2.java)
>       at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at javax.el.BeanELResolver.getValue(BeanELResolver.java:302)
>       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
>       at 
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
>       at org.apache.el.parser.AstValue.getValue(AstValue.java:123)
>       at org.apache.el.parser.AstEmpty.getValue(AstEmpty.java:45)
>       at org.apache.el.parser.AstNot.getValue(AstNot.java:42)
>       at 
> org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
>       at 
> org.apache.webbeans.el.WrappedValueExpression.getValue(WrappedValueExpression.java:68)
>       at 
> org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:85)
>       at 
> javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:260)
>       at 
> javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1007)
>       at javax.faces.component.UIComponent.isVisitable(UIComponent.java:289)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:752)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:991)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:778)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:991)
>       at 
> org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener._doTreeVisit(DebugPhaseListener.java:310)
>       at 
> org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener.afterPhase(DebugPhaseListener.java:286)
>       at 
> org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:111)
>       at 
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:185)
>       at 
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
>       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
> This happens because the DebugPhaseListener starts visiting the tree and, in 
> the process, needs to resolve a value expression, which points to an OWB 
> session bean.
> It only happens when the DebugPhaseListener is installed. In production mode 
> everything is fine.

-- 
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