1 Reply Latest reply on May 18, 2004 3:36 AM by ibruell

    clients and jndi, i dont have a clue!

    pokey909

      Hi!
      I'm now trying for several days to get a simple stateless session bean working together with a client. I use MyEclipse and JBossIDE.
      As MyEclipse dos not directly support client application (and so does not build any of the required jboss-client.xml etc.) I couldnt figure out how it could works by myself.
      How can I autogenerate application-client.xml and jboss-client.xml. Everytime I do a lookup I get the error
      javax.naming.NamingException: Failed to find j2ee.clientName in jndi env
      ...even with
      System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming.client");
      System.setProperty("java.naming.provider.url", "jnp://localhost:1099");
      System.setProperty("j2ee.clientName", "hello-client");

      WHat am I doing wrong? Or how is the "standard" way of setting these XMLs up?

      Thanks in advance

        • 1. Re: clients and jndi, i dont have a clue!

          Have you tried to use the jndi.properties file ?

          In my client classes i always use this code snippet:

           Properties prop = new Properties();
           prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
           prop.put(Context.PROVIDER_URL, "jnp://localhost:1099");
           prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
           InitialContext ctx = new InitialContext(prop);
          
           BeanHome home = javax.rmi.PortableRemoteObject.narrow(ctx.lookup("[BeanName]", BeanHomeClass.class);
          


          Hope that helps.