I have session Bean:
@Stateful
public class ContactBean implements Contact, Serializable {
@Inject private EntityManager manager;
@Inject private SessionContext ctx;
....
public void serializeMe() {
try {
java.rmi.MarshalledObject mo = new MarshalledObject(this);
mo.get();
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (ClassNotFoundException cnfe) {
cnfe.printStackTrace();
}
}
}And then from client I run serializeMe() (trying to serialize) method it thows exception: Exception in thread "Timer-2"Then I remove "@Inject private SessionContext ctx;" everything works fine.
java.lang.StackOverflowError
at sun.misc.SoftCache.get(SoftCache.java:269)
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:244)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1029)
....