0 Replies Latest reply on Jun 21, 2007 1:08 PM by Ricardo Marques

    Could not passivate; failed to save state

    Ricardo Marques Novice

      Hi guys

      I'm using ejb with a web application on jboss 4.0.5 with jdk 1.5 and i'm getting this exception:

      11:53:50,390 WARN [AbstractInstanceCache] failed to passivate, id=f373o8gy-s
      javax.ejb.EJBException: Could not passivate; failed to save state
       at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:423)
       at org.jboss.ejb.plugins.StatefulSessionInstanceCache.passivate(StatefulSessionInstanceCache.java:107)
       at org.jboss.ejb.plugins.AbstractInstanceCache.tryToPassivate(AbstractInstanceCache.java:209)
       at org.jboss.ejb.plugins.AbstractInstanceCache.tryToPassivate(AbstractInstanceCache.java:162)
       at org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy$OveragerTask.run(LRUEnterpriseContextCachePolicy.java:450)
       at java.util.TimerThread.mainLoop(Timer.java:512)
       at java.util.TimerThread.run(Timer.java:462)
      Caused by: java.io.NotSerializableException: java.lang.ThreadLocal
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
       at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
       at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
       at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
       at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
       at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
       at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
       at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:414)
       ... 6 more
      




      My code (Session bean statefull):

      protected transient Log log;
      private transient IdentitySession identitySession;
      
      public void ejbPassivate() throws EJBException, RemoteException {
       log.debug("bean passivating... ");
       log = null;
       identitySession.close();
       identitySession = null;
       }
      




      the attributes are transient because i had read somewhere that like that i could avoid serialization problems. but they remain, i've tried with and without them and the output is the same.

      IdentitySession is a non-serializable object and Log is a interface from commons logging also non-serializable.

      can anyone help?