0 Replies Latest reply on Jul 24, 2003 6:26 AM by bortolaso

    ServiceLocator Questions

    bortolaso

      In ServiceLocator i register "forever" my EJB Homes of Session Stateful beans. The problem arise when the objects are passivated and removed from EJB Container. How can i do to take my old objects?
      If i try to reinstantiate a new Object home the jboss throw a ClassCastException. Why??
      Which is the work of the initial context if i reload the entire application?


      This is the snap of the code:

      public EJBHome getRemoteHome(String jndiHomeName, Class className) throws ServiceLocatorException {

      EJBHome home = null;
      try {
      if (cache.containsKey(jndiHomeName)) {
      home = (EJBHome) cache.get(jndiHomeName);

      } else {
      Object objref = ic.lookup(jndiHomeName);
      home = (EJBHome) PortableRemoteObject.narrow(objref, className);
      cache.put(jndiHomeName, home);
      }
      } catch (NamingException ne) {
      throw new ServiceLocatorException(ne);
      } catch (Exception e) {
      throw new ServiceLocatorException(e);
      }

      return home;
      }