users@glassfish.java.net

RuntimeException through Stateless SessionBeans causes JNDI lookup crash

From: <glassfish_at_javadesktop.org>
Date: Tue, 14 Oct 2008 09:42:39 PDT

http://forums.sun.com/thread.jspa?threadID=5339763&tstart=0

Hello,

It seems there is a big problem with the RuntimeException thrown through two Stateless SessionBeans. Here is the code (without the interfaces, that are straight forward) :

public class ProcessorBean { public String process() { throw new RuntimeException("error"); } } /* This is a sub-bean that throws a simple RuntimeException */


public class OtherBean { public String hello() { return "processed by OtherBean"; } } /* Another sub-bean to test the catch-call (optional) */


public class TestBean
{
    @EJB
    private ProcessorLocal processor;
 
    @EJB
    private OtherLocal other;
 
    public String process()
    {
          String result = null;
          try
          {
              result = processor.process(); //will throws a RuntimeException
          }
          catch(Exception e)
          {
              result = other.hello(); //CRASH !!!! --> afther that processor.process() trhows a RuntimeException, all injections @EJB are down ! There will be a ejb.some_unmapped_exception written in the console.
          }
 
          return result;
    }
}



You will find a little Enterprise project to see the problem (just use the WebService tester in asadmin)
Note that there is no problem if an Exception that DOES NOT inherit from RuntimeException is thrown.

Maybe someone have an idea how to solve simply that problem ?

Thanks & Regards
[Message sent by forum member 'ctabin' (ctabin)]

http://forums.java.net/jive/thread.jspa?messageID=306828