0 Replies Latest reply on Apr 1, 2004 10:56 AM by kmarcos

    UndeclaredThrowableException wrapping CreateException

    kmarcos

      Hi all.
      First at all... sorry for my english mistakes...

      I'am generating a create exception in a simple session bean. On the client i get
      [java] Excepcion!!! java.lang.reflect.UndeclaredThrowableException - javax.ejb.CreateException: hola2

      The bizarre thing that i cant understand is that ejbCreate is called until i invoke a method in the Remote interface, ie. if i put in comments the bussines method and left only de home.create() nothing pass, but if i invoke the bussines method, the ejbCreate is invoked too....

      Well i believe that is wrong, but i don know... But it´s sure that my client must get a createException... right?

      thanks for any help!

      The code:

      in my ejbCreate i have:

      public void ejbCreate()throws RemoteException,CreateException {
       System.out.println("creando");
       throw new CreateException("hola2");
      }



      bussines method

      public void migrateHistoricData() throws RemoteException{
      try{
      System.out.println("va a migrar");
      }catch(Exception e){
      System.out.println("en bean other exception "+e.getMessage());;
       throw (RemoteException)e;
      }
      
      }


      and in my test client i have:

      MigrationManagerSessionHome home = (MigrationManagerSessionHome) PortableRemoteObject.narrow(obj,MigrationManagerSessionHome.class);
      MigrationManagerSession migraMgr = home.create();
      migraMgr.migrateHistoricData();


      if i put in comment migraMgr.migrateHistoricData(); nothing happens...but if i dont, i get on jboss server:
      11:38:32,851 INFO [STDOUT] creando

      and in my client the UndeclaredThrowableException.