1 Reply Latest reply on Apr 16, 2004 9:59 AM by adrianw

    EJBException: null

    adrianw

      Hello!

      I´m developing an EJB, modifying the source code of Duke's Bank example. The method where I have is this:
      --------------------------------------------------------------------------------
      public ArrayList getReservasOfHorario(String horario)
      throws InvalidParameterException {
      Debug.print("ReservaControllerBean-Sesion getReservasOfHorario");
      Collection t_reservas;
      ArrayList reservaList = new ArrayList();
      if (horario == null)
      throw new InvalidParameterException("null horario");
      try {
      t_reservas = objReservaHome.findByHorario(horario);
      if (t_reservas.isEmpty())
      System.out.println("Reserva No Encontrada: Excepcion");
      } catch (Exception ex) {
      return reservaList;
      }
      try {
      Iterator i = t_reservas.iterator();
      while (i.hasNext()) {
      Reserva objReserva2 = (Reserva)i.next();
      //Debug print
      System.out.println("Show iterator: " + i);
      System.out.println("Show object: " + objReserva2);
      //Hasta aqui
      DatosReserva datos = objReserva2.getDatos();
      reservaList.add(datos);
      }
      } catch (RemoteException ex) {
      throw new EJBException("getReservasOfHorario: "
      + ex.getMessage());
      }
      return reservaList;
      } // getReservasOfHorario
      ----------------------------------------------------------------------------------
      As you can see, this is very simple and "standard" code. But I have an error, like this:

      -----------------------------------------------------------------------------------
      19:57:41,203 INFO [STDOUT] Show iterator: java.util.AbstractList$Itr@ff6348
      19:57:41,203 INFO [STDOUT] Show object: MyReserva:2004-04-14 19:57:41.163
      19:57:41,203 ERROR [STDERR] Debug: ReservaBean-Entity ejbActivate
      19:57:41,203 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract negocio.util.DatosReserva negocio.ejb.reserva.Reserva.getDatos() throws java.rmi.RemoteException, causedBy:
      java.rmi.NoSuchObjectException: null; CausedByException is:
      null
      at org.jboss.ejb.plugins.AbstractInstanceCache.get(AbstractInstanceCache.java:116)
      at org.jboss.ejb.plugins.EntityInstanceCache.get(EntityInstanceCache.java:61)
      ......
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      at $Proxy58.getDatos(Unknown Source)
      at negocio.ejb.reserva.ReservaControllerBean.getReservasOfHorario(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ......
      at java.lang.Thread.run(Thread.java:534)
      19:57:41,213 ERROR [LogInterceptor] EJBException:
      javax.ejb.EJBException: getReservasOfHorario: null; CausedByException is:
      null; nested exception is:
      java.rmi.NoSuchObjectException: null; CausedByException is:
      null
      at negocio.ejb.reserva.ReservaControllerBean.getReservasOfHorario(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ......
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      at $Proxy60.getReservasOfHorario(Unknown Source)
      at negocio.web.ReservaJBean.populate(Unknown Source)
      at negocio.web.Dispatcher.doPost(Unknown Source)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      ........
      at java.lang.Thread.run(Thread.java:534)
      19:57:41,213 INFO [STDOUT] Excepcion remota al recoger las reservas de las 12:10: EJBException:; nested exception is:
      javax.ejb.EJBException: getReservasOfHorario: null; CausedByException is:
      null; nested exception is:
      java.rmi.NoSuchObjectException: null; CausedByException is:
      null
      19:57:41,213 INFO [STDOUT]
      ----------------------------------------------------------------------------------

      Anybody knows why I have this error? How can I solve it?

      Thanks

        • 1. Re: EJBException: null
          adrianw

          Hello!

          I found the problem, but I don't know how to solve it.

          Reserva EJB's primary key is java.sql.Timestamp

          This source code

          ----------------------------------------------------------
          Reserva objReserva2 = (Reserva)i.next();
          DatosReserva datos = objReserva2.getDatos();
          ----------------------------------------------------------

          I don't know why, but objReserva2 isn't a valid object. But if I change the primary key with a String, it runs. Why?