0 Replies Latest reply on May 12, 2005 4:34 AM by Edvardas Mazeika

    SessionContext in Stateful session bean

    Edvardas Mazeika Newbie

      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"
      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)
      ....
      Then I remove "@Inject private SessionContext ctx;" everything works fine.

      What I done wrong?