10 Replies Latest reply on Oct 9, 2013 10:48 AM by mkouba

    Grave: WELD-000019 Error destroying an instance Managed Bean

    edilmar

      Hi,

       

      I have an webapp with Glassfish 3.1.1, CDI Weld v20110404-1554, Apache CODI 1.0.5, JSF2, Richfaces4, JPA2, Hibernate4.2.6 and Firebird 2.5.2.

       

      I have many controllers JSF for CRUDs, using CODI @ConversationScoped and CDI @Named.

       

      When I exit any controller, Glassfish arises this kind of error:

      [class control.intranet.PaisController] with qualifiers [@Any @Default @Named] of control.intranet.org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldSubclass@da280e5

       

      How could I find what place in my code is generating this problem?

        • 1. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
          edilmar

          I discover that the problem occurs when I call conversation.close() (a method to clean up all data in the Apache CODI conversation scope).

          But I don't have any idea of what is the real problem, what object can't be destroyed from my controller.

          • 2. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
            luksa

            Please paste the whole error message.

            • 3. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
              luksa

              Ah, nevermind. you pasted the first part into the title. But can you also paste the stacktrace?

              1 of 1 people found this helpful
              • 4. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
                mkouba

                Please enable the DEBUG logging level for org.jboss.weld.bean.ManagedBean so that we can see what the real exception is.

                1 of 1 people found this helpful
                • 5. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
                  edilmar

                  Martin,

                   

                  I don't know how to set DEBUG logging level for org.jboss.weld.bean.ManagedBean.

                   

                  I didn't find on Internet how to do this.

                  I tried this into web.xml but no success:

                    <context-param>

                      <param-name>org.jboss.weld.bean.ManagedBean.DEBUG</param-name>

                      <param-value>true</param-value>

                    </context-param>

                   

                  I have the same problem using Glassfish 3.1.2 and a newer version of Weld.

                  I didn't test in Glassfish 4 because my webapp is not yet deploying in this version, because CODI x JEE7 compatibility problems.

                   

                  Thanks for any help.

                  • 6. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
                    mkouba

                    I'm no GlassFish expert but I was able to set the log level for weld module via admin GUI: Common Tasks > Configurations > server-config > Logger Settings > Log Levels tab > Add logger with name "org.jboss.weld" and level FINE. And I also found this: http://docs.oracle.com/cd/E18930_01/html/821-2416/gklmn.html#ghmdu.

                    • 7. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
                      edilmar

                      Hi,

                       

                      I got to enable DEBUG FINE level.

                      Now this exception is arising in Glassfish console:

                       

                      Grave: WELD-000019 Error destroying an instance Managed Bean [class control.intranet.PaisController] with qualifiers [@Any @Default @Named] of control.intranet.org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldSubclass@4d637136

                      Detalhado: throwing

                      java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException

                          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:195)

                          at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)

                          at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:85)

                          at control.intranet.org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldSubclass.lifecycle_mixin_$$_preDestroy(org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldSubclass.java)

                          at org.jboss.interceptor.util.InterceptionUtils.executePredestroy(InterceptionUtils.java:88)

                          at org.jboss.interceptor.util.InterceptionUtils.executePredestroy(InterceptionUtils.java:105)

                          at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.preDestroy(ManagedBean.java:208)

                          at org.jboss.weld.bean.ManagedBean.destroy(ManagedBean.java:353)

                          at org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.BeanStorage.removeBeanEntry(BeanStorage.java:106)

                          at org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.BeanStorage.resetStorage(BeanStorage.java:93)

                          at org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.DefaultConversation.endConversation(DefaultConversation.java:129)

                          at org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.DefaultConversation.close(DefaultConversation.java:122)

                          at org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.InjectableConversation.close(InjectableConversation.java:58)

                          at control.GenericCadController.closeConversation(GenericCadController.java:154)

                          at control.intranet.org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldSubclass.closeConversation(org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldSubclass.java)

                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                          at java.lang.reflect.Method.invoke(Method.java:606)

                          at org.jboss.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:114)

                          at org.jboss.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:133)

                          at org.jboss.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:112)

                          at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:65)

                          at control.intranet.org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldSubclass.closeConversation(org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldSubclass.java)

                          at control.intranet.org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldClientProxy.closeConversation(org$jboss$weld$bean-web-ManagedBean-class_control$intranet$PaisController_$$_WeldClientProxy.java)

                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                          at java.lang.reflect.Method.invoke(Method.java:606)

                          at com.sun.el.parser.AstValue.invoke(AstValue.java:234)

                          at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)

                          at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)

                          at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:56)

                          at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)

                          at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)

                          at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)

                          at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)

                          at javax.faces.component.UICommand.broadcast(UICommand.java:300)

                          at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)

                          at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:935)

                          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.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95)

                          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

                          at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)

                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                          at util.OpenSessionInViewFilter.doFilter(OpenSessionInViewFilter.java:50)

                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

                          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 com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

                          at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

                          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

                          at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

                          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

                          at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

                          at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

                          at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

                          at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

                          at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

                          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:724)

                      Caused by: java.lang.RuntimeException: java.lang.NullPointerException

                          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:71)

                          at org.jboss.weld.util.reflection.SecureReflections.ensureAccessible(SecureReflections.java:324)

                          at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)

                          at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)

                          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)

                          ... 74 more

                      Caused by: java.lang.NullPointerException

                          at org.jboss.weld.util.reflection.SecureReflections$14.work(SecureReflections.java:330)

                          at org.jboss.weld.util.reflection.SecureReflections$14.work(SecureReflections.java:325)

                          at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)

                          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67)

                          ... 78 more

                       

                      My method closeConversation just closes the CODI conversation:

                        public void closeConversation(ActionEvent event) {

                          conversation.close();

                        }

                       

                      and the exception shows many internal line codes from WELD. Then, I don't get to advance in my analysis.

                      • 8. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
                        mkouba

                        Well, it seems the NPE is thrown when invoking @PreDestroy callback on PaisController. Not sure why but it has something to do with interceptors. First I would try to update Weld - you're using version 1.1.1.Final and the latest 1.1.x version available is 1.1.16.Final (just replace the original weld-osgi-bundle.jar in ${GF_HOME}/glassfish3/glassfish/modules).

                        • 9. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
                          edilmar

                          Version 1.1.16 doesn't deploy with CODI in my GF 3.1.1.

                           

                          Grave: Exception while loading the app

                          Grave: Exception while shutting down application container

                          Grave: Exception while shutting down application container : java.lang.NullPointerException

                           

                          And at this moment it's impossible to upgrade GF, because I have +/- 50 servers running it.

                          • 10. Re: Grave: WELD-000019 Error destroying an instance Managed Bean
                            mkouba

                            Then I have no idea... I suppose you've checked the CODI documentation: Problems with Weld and Workarounds for Weld. And I would also try other Weld versions and post a question to CODI mailing list.