1 Reply Latest reply on Sep 9, 2005 3:13 AM by jaikiran pai

    Throws NoInitialContextException when narrows EJBObject from

    Paul Chan Newbie

      HelloHome home = (HelloHome) PortableRemoteObject.narrow(ref, HelloHome.class);
      Hello hello = home.create();

      Handle handle = hello.getHandle();
      Hello hello2 = (Hello) PortableRemoteObject.narrow(handle.getEJBObject(), Hello.class);

      It throws

      java.rmi.ServerException: Could not get EJBObject; nested exception is:
      javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
      at org.jboss.proxy.ejb.handle.StatelessHandleImpl.getEJBObject(StatelessHandleImpl.java:83)
      at tutorial.client.HelloClient.main(HelloClient.java:42)
      Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
      at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.jboss.proxy.ejb.handle.StatelessHandleImpl.getEJBObject(StatelessHandleImpl.java:76)
      ... 1 more


      However, does the Handle already containing the lookup and JNDI information? why i still get this Exception? how can i fix it?