Oracle Community | 807573 | 10 years ago
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    LDAP connectivity issue.

    Oracle Community | 10 years ago | 807573
  2. 0

    FULL PRODUCT VERSION : java version "1.7.0_72" Java(TM) SE Runtime Environment (build 1.7.0_72-b14) Java HotSpot(TM) Server VM (build 24.72-b04, mixed mode) ADDITIONAL OS VERSION INFORMATION : SunOS n3 5.10 Generic_150401-18 i86pc i386 i86pc A DESCRIPTION OF THE PROBLEM : When an LDAP response is received with status of LdapClient.LDAP_REFERRAL but no referrals are present (and handleReferrals is set to LDAP_REF_THROW), the following exception is received: java.lang.NullPointerException at com.sun.jndi.ldap.LdapCtx.processReturnCode( at com.sun.jndi.ldap.LdapCtx.processReturnCode( at com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch( at com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImpl( at com.sun.jndi.ldap.LdapNamingEnumeration.hasMore( Looking at the source for LdapCtx, res.referrals.elementAt(0) is invoked without first testing that res.referrals is not null. Yes, this is technically an invalid LDAP message, but invalid messages should not result in null pointer exceptions in the stack. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Here is our code snippet that calls into search(): NamingEnumeration<SearchResult> enumeration = null; try { setInterruptible(true); scheduleInterruptTimerTask(timer, interruptTimerTask, interruptTimeLimit); enumeration =, ldapSearchArguments.getFilter(), searchControls); SearchResult searchResult; while (enumeration.hasMore()) { searchResult =; returnedAttributes.add(searchResult.getAttributes()); } } finally { cancelInterruptTimerTaskAndSetUnInterruptible(interruptTimerTask); closeEnumeration(enumeration); } As mentioned in the Description, the LDAP response has a status of LdapClient.LDAP_REFERRAL but no referrals are present in the message. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The stack should be throwing some kind of NamingException rather than a null pointer exception. ACTUAL - See stack trace in Description. ERROR MESSAGES/STACK TRACES THAT OCCUR : See stack trace in Description. REPRODUCIBILITY : This bug can be reproduced always. CUSTOMER SUBMITTED WORKAROUND : We currently have to ignore referrals until this bug is fixed (i.e. handleReferrals is set to LDAP_REF_IGNORE).

    JDK Bug System | 1 year ago | Webbug Group
  3. 0

    NullPointerException on hasMore()

    Oracle Community | 2 decades ago | 843793
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    hasmore() throws nullpointer Exception

    Oracle Community | 1 decade ago | 843793
  6. 0

    NullPointerException on hasMoreImpl() of LdapNamingEnumeration

    Oracle Community | 1 decade ago | 843793

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch()
    2. Java RT
      1. com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch(
      2. com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(
      2 frames
    3. JavaServlet
      1. javax.servlet.http.HttpServlet.service(
      2. javax.servlet.http.HttpServlet.service(
      2 frames
    4. com.iplanet.server
      1. com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(
      2. com.iplanet.server.http.servlet.NSServletRunner.Service(
      2 frames