In my API documentation it says, regarding java.io.NotSerializableException:
"Thrown when an instance is required to have a Serializable interface. The serialization runtime or the class of the instance can throw this exception. The argument should be the name of the class. "
And, lo and behold, the class org.jboss.ejb.plugins.local.BaseLocalContainerInvoker$StatefulSessionProxy does not seem to implement the Serializable interface.
Might this solve the problem?
I believe that this is a bug in JBoss, and actually created a bug report (#541855) for it a couple of weeks ago.
Basically, the passivation of stateful session beans is not EJB2.0 compliant yet.
Thank you for your reply,
I'm very familiar with serialization and what cause this exception in general terms, but I don't have the clear picture about JBoss Pasivation mechanizm since it's obvoiusly slightly "differant" then one inside Sun's J2EE server (J2EE SDK 1.3.1, EJB 2.0).
I also made a small error when posting, the exception posted is related to the SessionContext and I was mentioning EntityContext, in fact in both cases the problem is same.
And if the problem is solved by taking care that all objects referenced inside EJBs are serializable or otherwise declared transient, it's fine.
Just I hoped to get straight forward answer how to avoid this Pasivation problem from someone familiar with JBoss implementation of EJB2.0.
And if Contexts are not serialized during pasivation does it affect anything else?
I have been having this problem since the first release of 3.0.0alpha. Unfortunately, no one ever provide a solution. I thought that was a problem of my system. Apparently it didn't.
This problem doesn't block any accesses to db. However, sometimes when doing hot deployment of my jar file, jboss will endlessly report the error message and the log file keeps growing until I shut jboss down. I get along with this problem but ignoring it.
Please someone help.
It's same thing with me.
I thought I would get rid of those problems if I provide only serializable attributes inside my EJBs, and it didn't help, so it's comming from some JBoss classes.
I was hoping that someone familiar with JBoss implementation of EJB 2.0 would have the answer how to get rid of this kind of the problem.
(I got straight answer that solved my EJBs 2.0 problems a few months ago from Dain)
Or at least the answer what's class trying to serialize those:
ontainerInvoker$StatefulSessionProxy" and Entity one.
if there are not serializable and why (is it's my error or problem with JBoss)
I encountered the same problem with a session bean that acceced the database in 2.4.4. this was solved by making the SQL connection and all other non-serializeable fields as transient. furthermore, in ejbPassivate all connections and nonserializeable fields were set to null. what this has done is rather queer. when the EJB passivates, *sometimes* one instance of the EJB does not passivate and throws an error, for example i might have 5 beans in the pool, 4 will passivate and one will throw an exception.
haven't tried in 3.0. you can try the above sol.
Good news!. The passavation problem is said to be solved in 3.0, 3.1 CVS and posssibly RC2.