4 Replies Latest reply on Jun 29, 2009 7:37 PM by asookazian

    SFSB timeout setting

      Hello!

      I am using JBoss 4.0.5.GA and Seam 1.1.

      I permanently get exceptions like that:

      19:23:07,124 WARN [Contexts] Could not destroy component: clientEditor
      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:87)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      ...
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:33)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:201)
       at org.jboss.seam.Component.callComponentMethod(Component.java:1647)
       at org.jboss.seam.Component.callDestroyMethod(Component.java:1603)
       at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:371)
       at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:218)
       at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:89)
       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)


      In Seam forum they told that one has to use @CacheConfig and set it to the value greater that http session timeout. Http session dies by default after 30 minutes, so CacheConfig should be set to 1800.

      Http session timeout can be set from web.xml, say, in one place. I want to set @CacheConfig also in one place and not in every bean. I found
      <max-bean-life>1800</max-bean-life>

      in standardjboss.xml, but it seems not to work (timeout 300 below):
      18:36:37,610 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      18:36:37,845 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=qwerty.ear,jar=qwerty.jar,name=UploadAction,service=EJB3 with dependencies:
      18:36:37,892 INFO [EJBContainer] STARTED EJB: qwerty.fileupload.UploadAction ejbName: UploadAction
      18:36:37,970 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=qwerty.ear,jar=qwerty.jar,name=CategoryVacanciesBean,service=EJB3 with dependencies:
      18:36:38,017 INFO [EJBContainer] STARTED EJB: qwerty.actions.CategoryVacanciesBean ejbName: CategoryVacanciesBean
      18:36:38,095 INFO [SimpleStatefulCache] Initializing SimpleStatefulCache with maxSize: 100000 timeout: 300 for jboss.j2ee:ear=qwerty.ear,jar=qwerty.jar,name=CategoryVacanciesBean,service=EJB3
      


      More, it seems that nobody looks in xml file any more:
      public @interface CacheConfig
      {
       int maxSize() default 100000;
      
       long idleTimeoutSeconds() default 300;
      }
      
      ...
      
      sessionTimeout = config.idleTimeoutSeconds();
      
      ...
      


      I do not know whether it is a bug or not...

      Please, advise, how to set SFSB timeout correctly in xml (not through annotations) for all SFSB beans in ear?

      By the way, can I control a timeout when a bean is passivated? And how can I list all instantiated/passivated/alive SFSB (through jmx-console, I suppose, but I cannot find where...)?

      Thank you in advance.

        • 1. Re: SFSB timeout setting
          boobalan_kj

          Hi

          you could control life time of bean by using the following configurations...

          <container-configuration>
          <container-name>Standard Stateful SessionBean</container-name>
          <container-cache-conf>
          <cache-policy>org.jboss.ejb.plugins.LRUStatefulContextCachePolicy</cache-policy>
          <cache-policy-conf>
          <min-capacity>50</min-capacity>
          <max-capacity>1000000</max-capacity>
          <remover-period>300</remover-period>
          <max-bean-life>300</max-bean-life>
          <overager-period>200</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>
          </container-cache-conf>
          </ <container-configuration>

          -------------------------------------------------
          max-bean-age:specifies the maximum period of
          -----------------
          inactivity in seconds a bean can have before it will be passivated by the overager process.

          max-bean-life: specifies the maximum period of
          ----------------
          inactivity in seconds that a bean can exist before being removed from the passivation store.


          Regards
          Bala

          • 2. Re: SFSB timeout setting

            thank you!

            btw, I found the answer to my first question.

            ejb3-interceptors-aop.xml:

            <domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
            ...
             <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=3600)
             </annotation>
            ...
             </domain>


            • 3. Re: SFSB timeout setting
              galder.zamarreno

               

              "boobalan_kj" wrote:
              Hi

              you could control life time of bean by using the following configurations...

              <container-configuration>
              <container-name>Standard Stateful SessionBean</container-name>
              <container-cache-conf>
              <cache-policy>org.jboss.ejb.plugins.LRUStatefulContextCachePolicy</cache-policy>
              <cache-policy-conf>
              <min-capacity>50</min-capacity>
              <max-capacity>1000000</max-capacity>
              <remover-period>300</remover-period>
              <max-bean-life>300</max-bean-life>
              <overager-period>200</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>
              </container-cache-conf>
              </ <container-configuration>

              -------------------------------------------------
              max-bean-age:specifies the maximum period of
              -----------------
              inactivity in seconds a bean can have before it will be passivated by the overager process.

              max-bean-life: specifies the maximum period of
              ----------------
              inactivity in seconds that a bean can exist before being removed from the passivation store.


              Regards
              Bala


              I'm afraid that is not true. Those parameters only control EJB2 beans, not EJB3.

              • 4. Re: SFSB timeout setting
                asookazian

                This is helpful regarding this problem:

                http://www.jboss.org/community/wiki/JbossTimeoutSettingForSeam

                It states that serializability problems may be the root cause of this exception as well. But if that's true, wouldn't you get serializable/passivation exceptions in the server.log? I've seen those before when I had a Map instance variable in my SFSB (and not marked transient).