1 Reply Latest reply on May 27, 2003 7:46 AM by manju_rn

    JNDI Lookup

    amaresh

      Hi,

      I am getting an exception while trying to lookup("java:comp/env") from the remote client.

      Properties p = new Properties();
      p.put ("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      p.put ("java.naming.provider.url","jnp://localhost:1099");
      p.put ("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      InitialContext ictx = new InitialContext(props);

      // Retrieve Context for java:comp/env
      Context myEnv = (Context)ictx.lookup("java:comp/env");

      Am I doing something wrong? If yes, then how can I get the context from the remote client.

      I am also getting exception while trying to access xyz/abc/mno.

      Does JBoss 3.0.4 and 3.2.0 puts some restriction over such access?

      regards,
      Amaresh

        • 1. Re: JNDI Lookup
          manju_rn

          I dunno about ur LocalHome llokup...but for Remote....following works fine

          Properties p = new Properties();

          p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.NamingContextFactory");

          p.put(Context.PROVIDER_URL, "localhost:1099");


          and then lookup with the Following
          Context jndiContext = getInitialContext();
          Object ref = jndiContext.lookup("ejbSample.Bank");
          ejbSample.BankHome home = (ejbSample.BankHome)PortableRemoteObject.narrow(ref, ejbSample.BankHome.class);


          Hope it Helps