2 Replies Latest reply on Jan 16, 2003 11:39 PM by xcopy

    strange problem about jndi lookup

    xcopy Newbie


      Properties p=new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, "localhost:1099");
      try {

      InitialContext ic=new InitialContext(p);
      Object ref=ic.lookup("Product");
      System.out.println("home: "+ref);
      home=(ProductHome)PortableRemoteObject.narrow(ref,ProductHome.class);

      }

      catch(Exception e)
      {e.printStackTrace();}


      }

      it works fine on the same machine with jboss.

      but when i start jboss on any another mathine
      and change"p.put(Context.PROVIDER_URL, "localhost:1099");"
      to "p.put(Context.PROVIDER_URL, "192.168.0.110:1099");" ..
      there is no exception reported,but the result of looking up is null!!,why? it seems that the codes can work only on the same machine with jboss
      any answers?
      thanks