ICEfaces
  1. ICEfaces
  2. ICE-7535

MyFaces 2: ACE showcase mechanism for getting managed beans can cause NPE with processAnnotations

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.0.RC1
    • Fix Version/s: 3.0
    • Component/s: Sample Apps
    • Labels:
      None
    • Environment:
      MyFaces 2 ACE Showcase
    • Assignee Priority:
      P3
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Compatibility/Configuration

      Description

      I'm not sure how to replicate this 100% predictably yet but I can occasionally get the ACE Showcase into a state where the following NPE is thrown when the FacesUtil.getManagedBean method is called:

      SEVERE: could not get value for bean panelListener
      java.lang.NullPointerException
      at org.apache.catalina.core.DefaultInstanceManager.processAnnotations(DefaultInstanceManager.java:460)
      at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:146)
      at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
      at org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider.postConstruct(Tomcat7AnnotationLifecycleProvider.java:90)
      at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:211)
      at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:332)
      at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:295)
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
      at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:171)
      at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:65)
      at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:116)
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
      at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:171)
      at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
      at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
      at org.icefaces.samples.showcase.util.FacesUtils.getManagedBean(FacesUtils.java:86)
      at org.icefaces.samples.showcase.view.navigation.NavigationController.navigate(NavigationController.java:145)
      at org.icefaces.samples.showcase.view.navigation.NavigationController.navigate(NavigationController.java:66)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
      at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
      at org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:94)
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:79)
      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:51)
      at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:371)
      at javax.faces.component.UICommand.broadcast(UICommand.java:103)
      at org.apache.myfaces.view.facelets.component.UIRepeat.broadcast(UIRepeat.java:1158)
      at org.apache.myfaces.view.facelets.component.UIRepeat.broadcast(UIRepeat.java:1158)
      at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:990)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:280)
      at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1275)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:728)
      at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:38)
      at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
      at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)

      This may be constrained to an app issue but it does require that the app be restarted/redeployed in order to use the particular demo that triggered the problem.

        Activity

        Hide
        Deryk Sinotte added a comment -

        I've seen this a few more times so I decided to take a look at what's going on in the debugger.

        Tomcat has an "annotationsCache" that uses a WeakHashmap to store cached annotations for classes that have been processed. The problem occurs when the cache gets hit for a lookup and, it appears, the WeakReference has disappeared. The attach screenshot shows the moment of doom about to occur.

        It may be related to our custom Window scope as most of the beans in the showcase are set to use that scope.

        Show
        Deryk Sinotte added a comment - I've seen this a few more times so I decided to take a look at what's going on in the debugger. Tomcat has an "annotationsCache" that uses a WeakHashmap to store cached annotations for classes that have been processed. The problem occurs when the cache gets hit for a lookup and, it appears, the WeakReference has disappeared. The attach screenshot shows the moment of doom about to occur. It may be related to our custom Window scope as most of the beans in the showcase are set to use that scope.
        Hide
        Deryk Sinotte added a comment -

        A Google search turned up a link to recent Tomcat 7 release notes (specifically 7.0.23):

        http://tomcat.apache.org/tomcat-7.0-doc/changelog.html

        The item of interest was:

        "Correct additional threading and premature clearance issues with the annotation cache."

        Digging in the Tomcat Bugzilla issues I found:

        https://issues.apache.org/bugzilla/show_bug.cgi?id=52042

        Which is exactly the problem we are having. I'll start running against Tomcat 7.0.23 and see if it goes away.

        Show
        Deryk Sinotte added a comment - A Google search turned up a link to recent Tomcat 7 release notes (specifically 7.0.23): http://tomcat.apache.org/tomcat-7.0-doc/changelog.html The item of interest was: "Correct additional threading and premature clearance issues with the annotation cache." Digging in the Tomcat Bugzilla issues I found: https://issues.apache.org/bugzilla/show_bug.cgi?id=52042 Which is exactly the problem we are having. I'll start running against Tomcat 7.0.23 and see if it goes away.
        Hide
        Deryk Sinotte added a comment -

        After running with Tomcat 7.0.23 and exercising the typical actions that would lead to the issue, it seems to have fixed it. Resolving as won't fix.

        Show
        Deryk Sinotte added a comment - After running with Tomcat 7.0.23 and exercising the typical actions that would lead to the issue, it seems to have fixed it. Resolving as won't fix.

          People

          • Assignee:
            Deryk Sinotte
            Reporter:
            Deryk Sinotte
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: