Hi there!
Passivation of stateful EJB's (in Weblogic) requires all attributes to implement serializable. Unforutnately, my attribute is an object that is declared as final and does not implement searializable.
I thought I could work around this problem by manually persisting/restoring the attribute when ejbPassivate or ejbActivate is called. Unfortunately I haven't worked out a way of persisting a non-serailizable object. Does anyone know how to solve this little bugger of a problem?
Any help is greatly appreciated.
Cheers
Mark
-
Non-Serializable Stateful EJB attributes (6 messages)
- Posted by: Mark K
- Posted on: January 25 2001 07:34 EST
Threaded Messages (6)
- Non-Serializable Stateful EJB attributes by Steve Chernyak on January 25 2001 09:17 EST
- Non-Serializable Stateful EJB attributes by Albert Zamus on January 25 2001 16:40 EST
- Non-Serializable Stateful EJB attributes by Mark K on January 26 2001 12:13 EST
- Non-Serializable Stateful EJB attributes by Costin Cozianu on January 26 2001 12:53 EST
- Non-Serializable Stateful EJB attributes by Ragavan Raman on January 26 2001 12:56 EST
- test Non-Serializable Stateful EJB attributes by Sapna Rajaputra on January 27 2001 00:45 EST
-
Non-Serializable Stateful EJB attributes[ Go to top ]
- Posted by: Steve Chernyak
- Posted on: January 25 2001 09:17 EST
- in response to Mark K
This is just a thought, but could you create another class that is serializable and declare it a part of your bean. You could then populate this class with the variables of the final class during passivation, and repopulate your final class during activation -
Non-Serializable Stateful EJB attributes[ Go to top ]
- Posted by: Albert Zamus
- Posted on: January 25 2001 16:40 EST
- in response to Mark K
Why dont you have your final class implement serialzable. EJB is based on RMI and everything is marshalled/demarshalled. So you have to have serializable Objects only. -
Non-Serializable Stateful EJB attributes[ Go to top ]
- Posted by: Mark K
- Posted on: January 26 2001 12:13 EST
- in response to Mark K
Thanks for your suggestions, but unfortunately they both don't solve my problem....
The object I'm trying to serialise is javax.mail.Session.
Steve
Good idea - but it won't work in this problem because javax.mail.Session has private attributes without setters/getters, so I can't restore the objects state.
Pavan
Unfortunately it's not my class and is declared final, so I can't extend and implement serializable.
-
Non-Serializable Stateful EJB attributes[ Go to top ]
- Posted by: Costin Cozianu
- Posted on: January 26 2001 12:53 EST
- in response to Mark K
Set the member field to null on ejbPassivate() which is invoked by the container.
You can also declare the field transient.
The field won't be serialized, and you have to think of a way to eventually recreate the field on ejbPassivate().
If you really need to recreate the field in the ejbActivate and you can't find an acceptable solution than your class should not be a Stateful Session Bean, in the first place.
There are plenty of classes and solutions outside javax.ejb
package. -
Non-Serializable Stateful EJB attributes[ Go to top ]
- Posted by: Ragavan Raman
- Posted on: January 26 2001 12:56 EST
- in response to Mark K
The javax.mail.Session instance(or the javax.mail.Store) can be stored in JNDI or in the worst case a database and can be retrieved back in the ejbActivate event.
But can anyone give me a better solution than this ? -
test Non-Serializable Stateful EJB attributes[ Go to top ]
- Posted by: Sapna Rajaputra
- Posted on: January 27 2001 00:45 EST
- in response to Mark K
this is for testing..dont consider this please
thanks