2 Replies Latest reply on May 7, 2004 12:23 PM by afleet

    [AbstractInstanceCache] failed to passivate

    afleet

      Hi,
      I have a stateful session bean which has an instance field of;

      public Context myInitialContext;

      I initialize this in ejbCreate, thus;

      myInitialContext = (Context)myInitialContext.lookup("java:comp/env");

      When I re-deploy the application having used it, I guess JBoss is
      passivating the bean. When it does so I see the following error...

      javax.ejb.EJBException: Could not passivate; failed to save state;
      CausedByException is: org.jboss.ejb.plugins.TxInterceptorBMT
      at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.passivateSession(StatefulSess
      ionFilePersistenceManager.java:378)
      at org.jboss.ejb.plugins.StatefulSessionInstanceCache.passivate(StatefulSessionInstanceCache
      .java:85)

      Since this error only started appearing after I inserted the instance
      variable it must be related,

      Any thoughts?

      Thanks,

      Andy

        • 1. Re:  [AbstractInstanceCache] failed to passivate

          You must remove nonserializable state in ejbPassivate.
          See the spec for the full lifecycle.

          • 2. Re:  [AbstractInstanceCache] failed to passivate
            afleet

            Hi Adrian,
            I thought this may be the issue, so I checked the spec prior to
            posting. On page 77, when listing the data types that are valid
            for passivation it says..

            • A reference to the environment naming context
            (that is, the java:comp/env JNDI context) or any of its subcontexts.

            Since my instance variable is set thus;

            myInitialContext = new InitialContext();
            myInitialContext =(Context)myInitialContext.lookup("java:comp/env");

            I thought I was OK - have I misunderstood?

            Thanks,

            Andy