2 Replies Latest reply on Nov 27, 2004 3:11 AM by Joan Horta Tosas

    JNDI lookup does not work anymore *confused*

    bug-c Newbie


      Unfortunately the lookup for the Home object of my SessionBeans do not work anymore. I cannot figure out what the problem is. I deployed my ear archive. According to the JMX JNDI console, my beans are deployed correctly (see below the snippet of the JMX JNDI console).

      When I now deploy my JUnitEE servlet and try to lookup the home interfaces, I always get a ClassCastException. The code I use is as follows:

      javax.naming.InitialContext initialContext = new javax.naming.InitialContext();
      Object objRef = initialContext.lookup("ejb/de.novatec.novacrm.administration.AdministrationInterface/Remote");
      Object narrowed = javax.rmi.PortableRemoteObject.narrow(objRef, de.novatec.novacrm.administration.AdministrationInterfaceHome.class);
      AdministrationInterfaceHome homeTest = (AdministrationInterfaceHome) narrowed;

      The narrowing always throws an exception. I do not understand why this is happening.

      Thanks for your time,

      ---------- JNDI JMX Console information GLOBAL JNDI NAMESPACE -----------------
       +- ejb (class: org.jnp.interfaces.NamingContext)
       | +- de.novatec.novacrm.administration.AdministrationInterface (class: org.jnp.interfaces.NamingContext)
       | | +- Remote (proxy: $Proxy58 implements interface de.novatec.novacrm.administration.AdministrationInterfaceHome,interface javax.ejb.Handle)

      ---------- JNDI JMX Console information end -----------------