0 Replies Latest reply on Mar 14, 2003 6:45 AM by Kasper Johansen

    Ldap and JBoss

    Kasper Johansen Newbie

      Is it possible to make a lookup to a central Ldapserver that redirects you to the real jboss server and returns the homeinterface to the client via the Ldap.

      The point is that i want to use the Ldap server as a telephone book that contains the services that the Jboss server is offering (could be different jboss servers) and then get the service the client asks for.

      i have tried to use this code:

      Creating the ldap ref object:
      // Create the initial context
      DirContext ctx = new InitialDirContext(env);

      javax.naming.Reference ref = new javax.naming.Reference("KontoFacadeHome",new javax.naming.StringRefAddr("URL",
      "rmi://62.61.150.102:1099/ejb/KontoFacadeHome"));

      // Perform bind
      ctx.rebind("cn=favorite", ref);


      Client App Code:
      env.put(Context.PROVIDER_URL, "ldap://62.61.150.102:389/o=J2EEServerServices");
      env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");

      InitialContext context = new InitialContext(env);

      //look up jndi name
      Object ref = context.lookup("cn=favorite");
      //look up jndi name and cast to Home interface
      kontoFacadeHome = (KontoFacadeHome) PortableRemoteObject.narrow(ref, KontoFacadeHome.class);

      hope someone can help me out here - been at it for days now !!!

      thx
      Kasper