Discussions

EJB programming & troubleshooting: Stale SessionBean Reference

  1. Stale SessionBean Reference (4 messages)

    I have an app that will hold a reference to a Stateful SessionBean for an extended period of time(hopefully forever). I've noticed that after a period of time, the reference becomes invalid. I assume that it's timing out.
    Is there a was to tell that the remote reference has become stale other than calling a method on it and having it throw an Exception?

    Thanks in advance.

    Threaded Messages (4)

  2. exceptions[ Go to top ]

    I've always relied on the exceptions (I believe the exception is a NoSuchObjectException). The only other way I can think of is if there was perhaps a vendor-specific stub method that the Stub class exposed but was not part of the remote interface, but I've never used anything like this.
  3. exceptions[ Go to top ]

    Thanks for your response.
    That's pretty much what I expected, but was hoping I'd missed something.
  4. Stale SessionBean Reference[ Go to top ]

    Hi,

    If you are using a Weblogic Server. You should set the value of idle-timeout-seconds (as per requirements) in the weblogic-ejb-jar.xml file. I think that would solve your problem.

    Akash.
  5. Stale SessionBean Reference[ Go to top ]

    What happens when it does become stale? I'm storing a rference to a OrderEntry ejb and, after a while, it disappears form the session and, when I go to pull the reference, it is null. Thanks