ejb@glassfish.java.net

RuntimeException from _at_PreDestroy methods ignored

From: Cheng Fang <Cheng.Fang_at_Sun.COM>
Date: Fri, 22 Sep 2006 14:50:44 -0400

I just noticed any RuntimeException from ejb3 stateless session beans
are ignored, and not logged in server.log. For example,

@Stateless
public class HelloBean implements HelloRemote {

  @PreDestroy
  private void remove() {
    System.out.println("about to remove the bean instance.");
    throw new IllegalStateException();
  }

After the ejb is undeployed, I can see the message "about to remove the
bean instance.", but no exceptions.

I understand the bean instance will be removed regardless of exceptions
in @PreDestroy. But I think it would be helpful to log a warning.
Otherwise, users will just assume everything inside @PreDestroy method
has run successfully.

-- 
Cheng