1 2 3 Previous Next 32 Replies Latest reply on Dec 6, 2006 9:55 AM by gavin.king Go to original post
      • 15. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
        rdewell

        OK, I've reproduced this using the Seam "issues" example which has a Session scoped SFSB "login".

        I made the following change ONLY in web.xml in both B1 and CR1:

        <session-config>
         <session-timeout>1</session-timeout>
        </session-config>
        


        Build each, and run each, visiting:

        http://localhost:8080/seam-issues/login.jsf
        


        Now, wait 1 minute for the session to timeout.

        In 1.1B1 you will not receive an error.

        In 1.1CR1 and CR2 you will receive the error we've been discussing.

        08:09:18,786 WARN [Contexts] Could not destroy component: login
        javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: 5c4o02-9sgq0c-ev6si2et-1-ev6sj163-c
        


        I can send you the builds if necessary.

        • 16. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
          gavin.king

          OK, thanks, that was a really subtle interaction between session context destruction and ManagedEntityIdentityInterceptor. Fixed now in CVS.

          • 17. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
            gavin.king

            Note that the reason we've been arguing is that this bug had absolutely nothing to do with SFSB timeouts and EJBNoSuchObjectExceptions. There is actually a bug in the EJB3 container that was swallowing runtime exceptions and rethrowing them as bogus EJBNoSuchObjectExceptions.

            It took me a while to track down the problem because of that.

            http://jira.jboss.com/jira/browse/EJBTHREE-800

            • 18. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
              gus888

              Hi Gavin,

              Thank you so much for this bug fix. Now, there is no exception again when I click logout after having used the CVS. However, if I don't click logout, and leave server alone for a while, the server will throw the exact same exception. I don't know whether it is a bug or not. Thank you for your advice.

              • 19. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                gavin.king

                This is not a bug, it is due to your SFSB timing out. Adjust the timeout.

                • 20. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                  gavin.king

                  Or possibly because your destroy method throws an exception.

                  • 21. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                    gus888

                    Hi Gavin,

                    Thank you so much for your quick reply. I try to test it.

                    • 22. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                      gus888

                      Hi Gavin,

                      Frankly, I don't really know how to set session timeout. I tried to add the following code in web.xml:

                      <session-config>
                       <session-timeout>3</session-timeout>
                      </session-config>

                      Then I login into system, after having waited for a while. I got the following exception. My destroy code is set in a super class which is extended by a SFSB.
                      @Destroy @Remove
                      public void destroy() {
                      
                      }

                      The exception:
                      2006-12-03 22:17:13,781 WARN [org.jboss.seam.contexts.Contexts] Could not destroy component: documentExplorer
                      javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: 5c4o04-cpvdto-eva7zhnz-1-evadcepo-64
                       at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:268)
                       at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.removeSession(StatefulRemoveInterceptor.java:127)
                       at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:87)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
                       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
                       at $Proxy564.destroy(Unknown Source)
                       at com.cvn.controller.common.BaseExplorer$$FastClassByCGLIB$$65feb1d8.invoke(<generated>)
                       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
                       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
                       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:69)
                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
                       at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
                       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:585)
                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
                       at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:38)
                       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:585)
                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
                       at org.jboss.seam.interceptors.SynchronizationInterceptor.serialize(SynchronizationInterceptor.java:30)
                       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:585)
                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
                       at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
                       at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
                       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
                       at org.jboss.seam.intercept.ClientSideInterceptor.interceptInvocation(ClientSideInterceptor.java:78)
                       at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:47)
                       at com.cvn.controller.document.DocumentExplorer$$EnhancerByCGLIB$$1f36ee84.destroy(<generated>)
                       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:585)
                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:102)
                       at org.jboss.seam.Component.callComponentMethod(Component.java:1793)
                       at org.jboss.seam.Component.callDestroyMethod(Component.java:1749)
                       at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:189)
                       at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:230)
                       at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:45)
                       at org.apache.catalina.session.StandardSession.expire(StandardSession.java:687)
                       at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:579)
                       at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:678)
                       at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:663)
                       at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1284)
                       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
                       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
                       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
                       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
                       at java.lang.Thread.run(Thread.java:595)
                      

                      Did I do anything wrong above? Thank you.

                      • 23. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                        lowecg2004

                        I had created this quick setup guide for our developers based on the information in this thread:

                        http://www.jboss.com/index.html?module=bb&op=viewtopic&t=93589

                        I hope this helps you out.

                        Chris.


                        There are a few important timeout values in the Seam environment that any Seam developer needs to be aware of.

                        The first one is obvious and it is the well known HTTP session-timeout value (the one that you set in web.xml). What catches most people out is that there also is a separate EJB3 SFSB timeout value. These SFSB timeout values must be set in 2 places.

                        Since Seam freely integrates these two environments, a difference in the two timeouts can cause apparently random exceptions like:

                        19:23:07,124 WARN [Contexts] Could not destroy component: login
                        javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: 5r4m5v-man6m0-etofwmzy-1-etog131z-
                        g
                         at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:268)
                         at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.removeSession(StatefulRemoveInterceptor
                        .java:127)
                         at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:8
                        7)
                         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                         at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.jav
                        a:77)
                        ...


                        It is worth mentioning that there is a @CacheConfig annotation that allows you to specify the SFSB timeout on a per class basis. This offers a fine grained level of control, however you often just need to set the value once and have done with it. So in order to align the HTTP session and the SFSB timeouts, you must amend configuration files. Also note that this example sets these values to be exactly the same. It is sometimes recommended that the SFSB timeouts are set to be longer than the HTTP session timeout.

                        1. HTTP Session Timeout

                        File: WEB-INF/web.xml

                        <session-config>
                         <session-timeout>15</session-timeout>
                        </session-config>


                        Note: Value is in minutes;

                        2. SFSB Timeout Part 1

                        File: PROJECT_HOME/embedded-ejb/conf/ejb3-interceptors-aop.xml

                        Find entry matching 'domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">':

                        <domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
                         ...
                         <!-- OCSS: Align this value with session timeout in web.xml -->
                         <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.CacheConfig) AND !class(@org.jboss.annotation.ejb.Clustered)">
                         @org.jboss.annotation.ejb.cache.simple.CacheConfig (maxSize=100000, idleTimeoutSeconds=900)
                         </annotation>


                        Set the idleTimeoutSeconds value.

                        Note: Value is in seconds;


                        3. SFSB Timeout Part 2

                        File: JBOSS_HOME\server\default\conf\standardjboss.xml

                        Find entry for '<container-name>Standard Stateful SessionBean</container-name>':
                         <container-configuration>
                         <container-name>Standard Stateful SessionBean</container-name>
                         ...
                         <container-cache-conf>
                         ...
                         <cache-policy-conf>
                         <remover-period>900</remover-period>
                         <max-bean-life>900</max-bean-life>
                        ...


                        Note: Value is in seconds; Also this config is required for every server that the Seam code is deployed to.

                        That is all. Aligning these three timeout values will prevent those "Could not destroy component: XXXX" exceptions and prevent some strange behaviour in your apps.

                        Further information and discussion, see the thread referenced at the start of this post.

                        • 24. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                          cavani

                          I think that on JBoss AS,

                          PROJECT_HOME/embedded-ejb/conf/ejb3-interceptors-aop.xml

                          shoud be

                          JBOSS_HOME/server/default/deploy/ejb3-interceptors-aop.xml

                          right?

                          And this could be a wiki page too...

                          • 25. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                            lowecg2004

                            Oops - yes, you're quite right.

                            And you'll be searching for 'domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">'

                            (there should be a '<' before "domain name" above - but this renders the string invisible when it is displayed in the forum.)

                            <domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
                             <!-- NON Clustered cache configuration -->
                             <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND !class(@org.jboss.annotation.ejb.Clustered)">
                             @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.simple.SimpleStatefulCache.class)
                             </annotation>
                             <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.PersistenceManager) AND !class(@org.jboss.annotation.ejb.Clustered)">
                             @org.jboss.annotation.ejb.cache.simple.PersistenceManager (org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.class)
                             </annotation>
                             <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.CacheConfig) AND !class(@org.jboss.annotation.ejb.Clustered)">
                             @org.jboss.annotation.ejb.cache.simple.CacheConfig (maxSize=100000, idleTimeoutSeconds=900)
                             </annotation>
                            
                             <!-- Clustered cache configuration -->
                             <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND class(@org.jboss.annotation.ejb.Clustered)">
                             @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.tree.StatefulTreeCache.class)
                             </annotation>
                             <annotation expr="!class(@org.jboss.annotation.ejb.cache.tree.CacheConfig) AND class(@org.jboss.annotation.ejb.Clustered)">
                             @org.jboss.annotation.ejb.cache.tree.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300)
                             </annotation>
                             </domain>


                            A wiki sounds like a great idea. Can you point me to the wiki page that tells me "how to create a wiki page"?!

                            C

                            • 26. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                              cavani

                              http://www.jboss.com/wiki/Wiki.jsp?page=JBossSeam

                              just create a link for your wiki page then create it....

                              1. edit Seam wiki page for link to new page like

                              http://www.jboss.com/wiki/Wiki.jsp?page=JbossTimeoutSettingForSeam

                              2. click on link and edit the page

                              just it!

                              Thanks,

                              • 27. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                                gus888

                                Thank you sooooo much, friends. It is really a big knowledge for me.

                                • 28. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                                  lowecg2004

                                  Done.

                                  http://wiki.jboss.org/wiki/Wiki.jsp?page=JbossTimeoutSettingForSeam

                                  A peer review is recommended and any comments are, of course, welcome.


                                  C.

                                  • 29. Re: Excessive [could not destroy component] 1.1B1 to 1.1CR1
                                    gus888

                                    Hi,

                                    I couldn't get a success. My settings are:
                                    web.xml

                                    <session-config>
                                     <session-timeout>15</session-timeout>
                                     </session-config>

                                    JBOSS_HOME/server/default/deploy/ejb3-interceptors-aop.xml:
                                    <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.CacheConfig) AND !class(@org.jboss.annotation.ejb.Clustered)">
                                     @org.jboss.annotation.ejb.cache.simple.CacheConfig (maxSize=100000, idleTimeoutSeconds=900)
                                     </annotation>

                                    JBOSS_HOME\server\default\conf\standardjboss.xml:
                                    <container-name>Standard Stateful SessionBean</container-name>
                                    ...
                                     <cache-policy-conf>
                                     <min-capacity>50</min-capacity>
                                     <max-capacity>1000000</max-capacity>
                                     <remover-period>900</remover-period>
                                     <max-bean-life>900</max-bean-life>
                                     <overager-period>300</overager-period>
                                     <max-bean-age>600</max-bean-age>
                                     <resizer-period>400</resizer-period>
                                     <max-cache-miss-period>60</max-cache-miss-period>
                                     <min-cache-miss-period>1</min-cache-miss-period>
                                     <cache-load-factor>0.75</cache-load-factor>
                                     </cache-policy-conf>

                                    I also changed the timeout time to 16 and 14, but all the three timeout time (14, 15, 16) gave the same exception:javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: 5c4o04-q5szlm-evd5usub-1-evd8gijv-3n. Did I do something wrong above? I really appreciate more guidance. Thank you.