2 Replies Latest reply on May 3, 2007 5:28 PM by Pete Muir

    Passivation

    Toni Beckman Novice

      Hi,

      in my stateful session beans I use field declarations like:

      Preferences preferences = Preferences.userRoot();
      SecureRandom secureRandom = new SecureRandom();
      


      Both are not serializable, which makes me wonder whether or not I should declare them @Transient?

      Will the fields/variables be null after passivation/activation?

      Then I use static fields in my entity beans like:

       public final static Pattern pattern = Pattern.compile("(\\w+://)([^/]+)(/?.*)");
      


      Is that ok?

        • 1. Re: Passivation
          Toni Beckman Novice

          I'm asking, because some passivation exceptions show up in my logfile. Unfortuantely they don't tell, which bean is causing them.

          9:35:48,152 FATAL [RegularObjectPersister] error
          java.lang.reflect.InvocationTargetException
           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.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
           at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
           at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
           at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
           at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
           at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
           at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
           at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
           at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
           at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
           at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
           at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
           at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
           at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
           at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
           at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
           at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
           at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
           at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
           at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
           at org.jboss.serial.persister.ArrayPersister.saveObjectArray(ArrayPersister.java:110)
           at org.jboss.serial.persister.ArrayPersister.writeData(ArrayPersister.java:101)
           at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
           at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
           at org.jboss.serial.io.JBossObjectOutputStream.writeObjectOverride(JBossObjectOutputStream.java:181)
           at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
           at org.jboss.serial.io.MarshalledObject.<init>(MarshalledObject.java:51)
           at org.jboss.ejb3.stateful.StatefulBeanContext.writeExternal(StatefulBeanContext.java:405)
           at org.jboss.serial.persister.ExternalizePersister.writeData(ExternalizePersister.java:58)
           at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
           at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
           at org.jboss.serial.io.JBossObjectOutputStream.writeObjectOverride(JBossObjectOutputStream.java:181)
           at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
           at org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:347)
           at org.jboss.ejb3.cache.simple.SimpleStatefulCache.passivate(SimpleStatefulCache.java:196)
           at org.jboss.ejb3.cache.simple.SimpleStatefulCache$SessionTimeoutTask.run(SimpleStatefulCache.java:129)
          Caused by: java.util.ConcurrentModificationException
           at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
           at java.util.HashMap$EntryIterator.next(HashMap.java:883)
           at java.util.HashMap$EntryIterator.next(HashMap.java:881)
           at org.hibernate.engine.StatefulPersistenceContext.serialize(StatefulPersistenceContext.java:1138)
           at org.hibernate.impl.SessionImpl.writeObject(SessionImpl.java:1930)
          
          


          • 2. Re: Passivation
            Pete Muir Master

            i think they nee to be private transient Foo foo - @transient is annotation for jpa iirc