I'm seeing quite a few of the following exceptions in my application:
Could not activate; failed to restore state at org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.activateSession(StatefulSessionFilePersistenceManager.java:306) at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:265) ... Caused by: java.lang.ClassCastException: org.jboss.serial.io.MarshalledObject at org.jboss.ejb3.stateful.StatefulBeanContext.readExternal(StatefulBeanContext.java:416) at org.jboss.serial.persister.ExternalizePersister.readData(ExternalizePersister.java:72) at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:412) at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:82) at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:643) at org.jboss.serial.io.JBossObjectInputStream.readObjectOverride(JBossObjectInputStream.java:163) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:342) at org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.activateSession(StatefulSessionFilePersistenceManager.java:292) ... 100 more
I am aware that there is a difference between timeouts of SFSB and HTTP session, the values of which I have aligned as per the discussion at the following:
Still no joy.
The next problem that could causes passivation errors is the fact that my stateful beans are not serializable either directly or indirectly due to a class member. Trying to recreate this outside of the application server is proving tricky since my beans naturally use the injection mechanisms of Seam. Therefore if I'm to test serialization properly, then I need to prepare the SFSBs in a SeamTest.
This is where I'm stuck due to the generated beans that I get back from the mock context being proxies rather than instances of the beans. How can I test if my SFSBs are serializable? Am I able to instruct the embedded EJB3 container to passivate my bean and then reawaken it? Or is there a way to get at the underlying beans to serialize them myself? Or am I on the wrong track entirely? Basically, I need to track down the cause of the above exception and somehow try and prevent further problems from cropping up. Any suggestions?