2 Replies Latest reply on Jun 23, 2003 9:07 PM by 843793

    Newbie Question w/Java 1.4 & InitialContext

    843793
      The below listed code works fine using the included properties and jdk1.3.1. Using jdk1.4.1_02, I get the following exception...

      // Exception I got using JDK 1.4
      javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name ''
      at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:2942)
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2863)
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2669)
      at com.sun.jndi.ldap.LdapCtx.c_list(LdapCtx.java:1033)
      at com.sun.jndi.toolkit.ctx.ComponentContext.p_list(ComponentContext.java:551)
      at com.sun.jndi.toolkit.ctx.PartialCompositeContext.list(PartialCompositeContext.java:273)
      at com.sun.jndi.toolkit.ctx.PartialCompositeContext.list(PartialCompositeContext.java:262)
      at javax.naming.InitialContext.list(InitialContext.java:387)
      at AppList.main(Unknown Source)


      // Property file: jndi.properties:
      com.sun.jndi.ldap.netscape.schemaBugs=true
      java.naming.security.authentication=simple
      java.naming.provider.url=ldap://localhost:389/o=My Corp
      java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
      java.naming.security.principal=cn=Directory Manager
      java.naming.security.credentials=mypw


      ////////// Code Here
      import javax.naming.*;

      class AppList {
      public static void main(String[] args) {
      String target = "";

      try {
           Context ctx = new InitialContext();

           NamingEnumeration enum = ctx.list(target);
           while (enum.hasMore()) {
           System.out.println(enum.next());
           }
           } catch (NamingException e) {
           e.printStackTrace();
           }
      }
      }


      Thanks for any help with this, I'm stumped.

      -Michael Gray