Discussions

EJB programming & troubleshooting: Cannot rethrow exceptions to client from stateless session bean

  1. I have a stateless session bean and within it I am doing this to rethrow exceptions to the client.

    try
    {
    }
    catch(Exception e)
    {
     throw new TelexHandlerException("", "");
    }

    My TelexHandlerException class extends Exception. I have made sure that the method is defined as throwing this exception in the remote interface. However, I still cannot get the exception caught by the client at all.

    I have tried variations - throwing an EJBException, throwing a general exception, making TelexHandlerException a subclass of RemoteException, making TelexHandlerException a subclass of EJBException and still nothing gets caught on the client. What am I doing wrong?

    Incidentally I am using weblogic 5.1. There has been mention of a bug on some of the forums but I don't know if this is correct.

    Any ideas would be greatly appreciated!
  2. First of all, for me to answer you, you need to explain what exception is!
  3. In SSLB
    SessionBean{
    methodB(){
    try
    {
    // DO something
    }
    catch(Exception e)
    {
      throw new TelexHandlerException("", "");
    // assuming TelexHandlerException is a Runtime Exception
    }
    }
    }

    In client
    {
    try{
    SessionBean b.methodB()
    }catch(RemoteException e){
    // Do Something
    }

    }