Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2979

Session invalidation in Development Stage causes error in OpenWebBeans

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.3-SNAPSHOT
    • None
    • JSR-314
    • None
    • MyFaces 2.0.3-SNAPSHOT in Dev mode, OpenWebBeans 1.0.0, Tomcat 6.0.29 (with Glassfish EL 2.2)

    Description

      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.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            lu4242 Leonardo Uribe
            jankeesvanandel JCC Van Andel
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment