8 Replies Latest reply on Mar 3, 2004 4:53 AM by Ignacio de Cordoba

    StatefulSessionPersistenceManager

    Alan McDade Newbie

      How do I configure my instalation of JBoss to work with Stateful Session Beans.

      [UUIDServiceBean] TRANSACTION ROLLBACK EXCEPTION:Could not activate; nested exception is:
      java.io.FileNotFoundException: C:\java\jboss\JBoss-2.4.3_Jetty-3.1.3-1\jboss\db\sessions\UUIDServiceBean\1007558006672.s
      er (The system cannot find the file specified); nested exception is:
      java.rmi.NoSuchObjectException: Could not activate; nested exception is:
      java.io.FileNotFoundException: C:\java\jboss\JBoss-2.4.3_Jetty-3.1.3-1\jboss\db\sessions\UUIDServiceBean\1007558006672.s
      er (The system cannot find the file specified)
      [UUIDServiceBean] java.rmi.NoSuchObjectException: Could not activate; nested exception is:
      [UUIDServiceBean] java.io.FileNotFoundException: C:\java\jboss\JBoss-2.4.3_Jetty-3.1.3-1\jboss\db\sessions\UUIDServiceBean
      \1007558006672.ser (The system cannot find the file specified)
      [UUIDServiceBean] at org.jboss.ejb.plugins.AbstractInstanceCache.get(AbstractInstanceCache.java:211)
      [UUIDServiceBean] at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.ja
      va:194)
      [UUIDServiceBean] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
      [UUIDServiceBean] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      [UUIDServiceBean] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
      [UUIDServiceBean] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
      [UUIDServiceBean] at org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:341)
      [UUIDServiceBean] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:395)
      [UUIDServiceBean] at java.lang.reflect.Method.invoke(Native Method)
      [UUIDServiceBean] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      [UUIDServiceBean] at sun.rmi.transport.Transport$1.run(Transport.java:152)
      [UUIDServiceBean] at java.security.AccessController.doPrivileged(Native Method)
      [UUIDServiceBean] at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      [UUIDServiceBean] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      [UUIDServiceBean] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      [UUIDServiceBean] at java.lang.Thread.run(Thread.java:484)

        • 1. Re: StatefulSessionPersistenceManager
          marc fleury Master

          > How do I configure my instalation of JBoss to work with Stateful Session Beans.

          push the green button on the left,

          <snip stack trace>

          if you really want to get someone to help please read the guidelines as to how to report a problem it is detailed on the website under netiquette at this point it is very hard for anyone to understand your problem

          It seems there is a session that is passivated somewhere but the JBoss server can't read it back for some filesystem issue,

          dig, come back with findings

          • 2. Re: StatefulSessionPersistenceManager
            arthurg Newbie

            Alan,

            I have seen this occur when a stateful session bean reaches its maximum life time. In Jboss, firstly, after a period of time, a stateful bean is passivated and serialized to disk. After that, if it is still not accessed after a period of time, the serialized file on disk is destroyed. When this occurs you cannot access the stateful session bean again. If you want to handle this specific error in code you can catch the java.rmi.NoSuchObjectException that it generates.

            The lifetime of the bean is defined in the standardjboss.xml file under your conf directory in jboss. In the xml file look at the <container-configuration> element for "Standard Stateful SessionBean". Under there is a <cache-policy-conf> element, containing various settings for caching. If not sure exactly how it works, but the <max-bean-life> element relates to the period of inactivity after which the bean is removed from disk.

            arthur.

            • 3. Re: StatefulSessionPersistenceManager
              Alan McDade Newbie

              Hi All,

              Thanks Mark, if that is as funny as it gets don't give up the day job. You are right I haven't explained the problem well enough to expect help.

              It was the first time I had used a stateful session bean in jboss and I assumed it was a configuration problem. Turns out the bean was not being passivated properly because I had made the properties private!!

              Thanx for the help anyway.

              Alan

              • 4. Re: StatefulSessionPersistenceManager
                marc fleury Master

                This deserves to be a FAQ, thanks for the detailed answer above I will include it.

                marcf

                • 5. Re: StatefulSessionPersistenceManager
                  Ignacio de Cordoba Novice

                  Hi there,
                  I see it has passed some time since last post in this thread, but I am having a similar problem in my remote client to JBoss... I get many "Could not activate; failed to restore state;" exceptions.

                  Could anybody post how I can increase the pasivation and expiration times for Session EJBs?
                  (I just got JBoss 3.2.1 today)

                  The exact exception is:
                  02:21:00.068 WARN!! Could not activate; failed to restore state; CausedByException is:
                  /var/lib/jboss-3.2.1/server/default/tmp/sessions/CVUCMManager-dfd44vgp-33/dfd3xsoh-31.ser (No such file or directory)
                  java.rmi.NoSuchObjectException: Could not activate; failed to restore state; CausedByException is:
                  /var/lib/jboss-3.2.1/server/default/tmp/sessions/CVUCMManager-dfd44vgp-33/dfd3xsoh-31.ser (No such file or directory)
                  at org.jboss.ejb.plugins.AbstractInstanceCache.get(AbstractInstanceCache.java:122)
                  at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:212)
                  at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
                  at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
                  at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
                  at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
                  at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
                  at org.jboss.ejb.StatefulSessionContainer.internalInvoke(StatefulSessionContainer.java:410)
                  at org.jboss.ejb.Container.invoke(Container.java:674)
                  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:324)
                  at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
                  at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)
                  at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:324)
                  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
                  at sun.rmi.transport.Transport$1.run(Transport.java:148)
                  at java.security.AccessController.doPrivileged(Native Method)
                  at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
                  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
                  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
                  at java.lang.Thread.run(Thread.java:536)


                  thanks for any help,
                  Ignacio

                  • 6. Re: StatefulSessionPersistenceManager
                    Bernd Zeitler Expert

                    Watch <container-configuration> in standardjboss.xml . You can change the standard configuration, edit a new one here or provide a new configuration with your jboss specific deployment descriptor for your beans.

                    Greetings,
                    Frito

                    • 7. Re: StatefulSessionPersistenceManager
                      Ignacio de Cordoba Novice

                      Thanks for your reply.
                      I had seen that file as it is the same that for 2.x JBoss. My problem is that I'd like to know which of the fields makes it longer for JBoss to passivate a Session Bean and which of the fields makes it longer to expire.

                      <cache-policy-conf>
                      <min-capacity>50</min-capacity>
                      <max-capacity>1000000</max-capacity>
                      <remover-period>1800</remover-period>
                      <max-bean-life>1800</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>

                      Thanks again,
                      Ignacio

                      • 8. Re: StatefulSessionPersistenceManager
                        Ignacio de Cordoba Novice

                        Hi there,
                        even it has passed a long time since this post, I am still facing the same problem with statefull session beans.
                        In order to avoid catching the exception (it is tedious if you use the bean in many places in the code) anobody has a recommendation on how to detect if the session bean has been erased?
                        Of course I can use a private getter method and invoke a dumb method in the bean before returning it... that would throw the NoSuchObjectException and you can recreate it... but that would add a unneccesary method calling overload.
                        Any other ideas?

                        Thanks,
                        Ignacio