3 Replies Latest reply on Dec 23, 2009 12:29 PM by Mohammed Hewedy

    How to catch Runtime Exceptions in EJBs

    Mohammed Hewedy Newbie

         Hence all runtime exception thrown by a Session bean is encapsulated in EJBException, So, how to handle run time exceptions that I throw in Session beans, such as IllegalArgumentException (using getCause() ?? )

       

      ex:

      try{
             remoteBean.doSomeMethod():
      }catch (Exception ex){    // in stand alone client,
         if (ex.getCause().getClass() == IllegalArgumentException.class){
             // do handle IllegalArgumentException
         }else if (ex.getCause().getClass() == NullPointerException.class{
                          // ...
      }// etc .
      
      }