2 Replies Latest reply on May 21, 2018 11:22 AM by Janice Guzman

    WildFly 11, Invalid URL scheme name "ldap"

    Janice Guzman Newbie

      Hi,

       

      I'm having this issue starting with WildFly 11 when I trying to search for an entry with a colon (:) in the DN. It works for other entries but fails when there's a colon.

       

      Exception message:

      WFNAM00007: Invalid URL scheme name "ldap"

       

      Stack trace:

      org.wildfly.naming.client.WildFlyRootContext.getProviderContext(WildFlyRootContext.java:808), org.wildfly.naming.client.WildFlyRootContext.getAttributes(WildFlyRootContext.java:432), javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:142), javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:142), javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:137),

       

      Code:

       

      Hashtable props = new Hashtable();

      props.put("java.naming.factory.initial","com.sun.jndi.ldap.LdapCtxFactory"); 

      props.put("com.sun.jndi.ldap.connect.pool","true");

      props.put("java.naming.provider.url","ldap://localhost:25489");

      props.put("java.naming.security.authentication","simple");

      props.put("java.naming.security.credentials","password");

      props.put("java.naming.security.principal","cn=root,o=main");

       

      try

      {

      System.out.println("\nConnecting to ldap://localhost:25489");

      InitialDirContext ctx = new InitialDirContext(props);

       

      String failedTestDn = "loginIds=USER:blue,CN=mainservice,OU=service,O=data,O=main";

      Attributes failedAttrs = ctx.getAttributes(failedTestDn);

      System.out.println("Got: " + failedAttrs.get("distinguishedName").get());

      }

      catch (NamingException e)

      {

      e.printStackTrace();

      }