Announcement Announcement Module
Collapse
No announcement yet.
Size limit ignored? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Size limit ignored?

    We use Spring LDAP and we have a weird problem. The LDAP is configured to have a size limit of 999 results. So when you perform a search that's not specific enough on the LDAP itself, you get an error if the result is too big.

    Now, when we perform the same search with our application, it keeps going and going and it doesn't stop. We have to shut down the server to end it, which isn't quite the result we want .

    Do you guys have any idea why Spring LDAP ignores the size limit or time limit on the LDAP? Is it possible to configure a size limit in the configuration of LDAP? We're using 1.2-RC1.

  • #2
    The thing is, Spring LDAP does not bother itself with this kind of stuff. If the server has a size or time limit configured, that should be applied regardless of the client. If you need to send a size or time limit with the request, you should use some of the search methods in LdapTemplate that take a SearchControls instance, and set those requirements there. Once again, Spring LDAP won't do anything with that information - it will just be forwarded to the server.

    If something is unclear or I'm misunderstanding, please don't hesitate to ask again; in that case a code snippet might help to gain some more insight.

    Comment


    • #3
      Okay, this worked, but now we encounter another issue.

      In our LDAP we have Agencies with child nodes (Departments). Now, when we want to lookup all departments that belong to a certain agency, we don't get any results. The list is empty.

      Is there something wrong with our code:


      Code:
          SearchControls searchControls = new SearchControls();
          searchControls.setCountLimit(ldapSizeLimit);
          searchControls.setTimeLimit(ldapTimeLimit);
          List intermediateResults = ldapTemplate.search(dn, filterStr, searchControls, new AttributesToDepartmentMapper());
      To look up persons, it works like a charm. Is it because Department is a child node, that the search fails?

      Comment


      • #4
        Spring LDAP will usually do this for you, but when supplying your own SearchControls instance you are also responsible for specifying the search scope. The default search scope when creating a SearchControls instance is SearchControls.ONELEVEL_SCOPE, meaning that only entries at the same level will be returned. You'll want to specify SearchControls.SUBTREE_SCOPE instead.

        Comment


        • #5
          I am also attempting to limit the size of the of the result list using the callbackhandler. (see code below)

          Note: Everything seems to work fine when I don't use the callbackhandler and searchcontrols. (see commented line)

          Code:
          SearchControls sc = new SearchControls();
          sc.setCountLimit(2);
          sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
          sc.setReturningObjFlag(true);
          
          ...................
          
          CollectingNameClassPairCallbackHandler handler = new ContextMapperCallbackHandler(getListContextMapper());
          
          List searchResults = null;
          AndFilter filter = new AndFilter();
          DistinguishedName dn = new DistinguishedName();
          filter.and(...);
          ldapTemplate.search(dn,filter.encode(),sc,handler);
          //searchResults = ldapTemplate.search(dn, filter.encode(), getListContextMapper());
          searchResults= handler.getList();
          But I get the following exception:

          SystemErr R Caused by: java.lang.VerifyError: return bytecode incompatible with return type (class: org/springframework/ldap/support/LdapUtils method: convertLdapException(Ljavax/naming/NamingExceptionLorg/springframework/ldap/NamingException at pc: 707

          Any clue as to what this exception means? Could it be because some of the data coming back are byte arrays? If so... what is the alternative to CollectingNameClassPairCallbackHandler ?

          Any help is appreciated.

          Comment


          • #6
            That sure looks nasty. We need to see the complete stack trace. Use the [code][/code] tags.

            Also, which JDK and LDAP server are you using?

            Comment


            • #7
              Here it is.... Although I don't think it says much in terms of the spring exception. I wrapped the search code with a try/catch.... but it doesn't hit the catch block. Stepping through the code.... it hits the search method.... then doesn't come back.

              To answer your question:
              JDK - WebSphere Portal 6.x JRE (this means java 1.4)
              LDAP Server - Active Directory


              Code:
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R javax.faces.el.EvaluationException: javax.faces.el.EvaluationException: Error getting property 'currentUser' from bean of type com.abc.def.EmployeeProfilePortletView: java.lang.VerifyError: return bytecode incompatible with return type (class: org/springframework/ldap/support/LdapUtils method: convertLdapException(Ljavax/naming/NamingException;)Lorg/springframework/ldap/NamingException;) at pc: 707
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:186)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:137)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:344)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at javax.faces.webapp.UIComponentTag.isSuppressed(UIComponentTag.java:826)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:458)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at com.sun.faces.taglib.html_basic.OutputTextTag.doStartTag(OutputTextTag.java:184)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at com.ibm._jsp._EmployeeProfilePortletView._jspx_meth_h_outputText_4(_EmployeeProfilePortletView.java:291)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at com.ibm._jsp._EmployeeProfilePortletView._jspx_meth_h_panelGroup_2(_EmployeeProfilePortletView.java:317)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at com.ibm._jsp._EmployeeProfilePortletView._jspx_meth_h_panelGrid_1(_EmployeeProfilePortletView.java:631)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at com.ibm._jsp._EmployeeProfilePortletView._jspx_meth_h_panelGroup_0(_EmployeeProfilePortletView.java:665)
              [9/13/07 10:19:41:615 CDT] 000000f5 SystemErr     R 	at com.ibm._jsp._EmployeeProfilePortletView._jspx_meth_h_panelGrid_0(_EmployeeProfilePortletView.java:729)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm._jsp._EmployeeProfilePortletView._jspx_meth_h_form_0(_EmployeeProfilePortletView.java:1859)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm._jsp._EmployeeProfilePortletView._jspx_meth_f_view_0(_EmployeeProfilePortletView.java:1896)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm._jsp._EmployeeProfilePortletView._jspService(_EmployeeProfilePortletView.java:126)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:91)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:204)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:633)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at org.apache.pluto.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:112)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.faces.portlet.httpbridge.PortletRequestDispatcherWrapper.include(PortletRequestDispatcherWrapper.java:61)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.faces.portlet.httpbridge.PortletRequestDispatcherWrapper.forward(PortletRequestDispatcherWrapper.java:35)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:325)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.faces.portlet.httpbridge.PortletExternalContextWrapper.dispatch(PortletExternalContextWrapper.java:83)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:254)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.faces.portlet.PortletViewHandlerImpl.renderView(PortletViewHandlerImpl.java:74)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.faces.application.PortletViewHandlerImpl.renderView(PortletViewHandlerImpl.java:74)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:220)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:118)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.faces.portlet.FacesPortlet.doRender(FacesPortlet.java:321)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.faces.portlet.FacesPortlet.doView(FacesPortlet.java:354)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.wawanesa.wpd.portlets.EmployeeProfilePortlet.doView(EmployeeProfilePortlet.java:34)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.faces.portlet.FacesPortlet.doDispatch(FacesPortlet.java:256)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.wps.pe.pc.std.cmpf.impl.PortletFilterChainImpl.render(PortletFilterChainImpl.java:144)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.dispatch(PortletServlet.java:130)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.doGet(PortletServlet.java:69)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.wps.pe.pc.std.cache.CacheablePortlet.service(CacheablePortlet.java:393)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:633)
              [9/13/07 10:19:41:630 CDT] 000000f5 SystemErr     R 	at com.ibm.wps.pe.om.definition.impl.ServletDefinitionImpl$RDWrapper.include(ServletDefinitionImpl.java:419)
              [9/13/07 10:19:41:646 CDT] 000000f5 SystemErr     R 	at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:206)
              [9/13/07 10:19:41:646 CDT] 000000f5 SystemErr     R 	at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:168)
              [9/13/07 10:19:41:646 CDT] 000000f5 SystemErr     R 	at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.render(PortletInvokerImpl.java:97)

              I'm also including my context mapper method which may or may not help:

              Code:
              	private static class ListPersonContextMapper implements ContextMapper{
              		public Object mapFromContext(Object ctx){
              			User user = new User();
              			try{
              			DirContextAdapter context = (DirContextAdapter) ctx;			
              			
              			user.setUserId(context.getStringAttribute(LDAPAttributes.DISTINGUISHED_NAME));
              					user.setDeskPhone(context.getStringAttribute(LDAPAttributes.DESK_PHONE));
              			user.setExtid((byte[])context.getObjectAttribute(LDAPAttributes.EXTID));
              			user.setGivenName(context.getStringAttribute(LDAPAttributes.GIVEN_NAME));
              			user.setSn(context.getStringAttribute(LDAPAttributes.SN));
              			user.setTitle(context.getStringAttribute(LDAPAttributes.TITLE));
              			} catch (Exception ne){
              				ne.printStackTrace();
              			}
              			return user;
              		}
              	}
              Thanks for looking into this!

              Comment


              • #8
                Hmmm, Websphere... I'm thinking IBM JVM, which might possibly be the reason you're getting the very nasty Error (it's an Error, not an Exception which is why it's not caught in the normal try/catch - if you would do catch(throwable t) that would catch the Error as well). We have some special handling with the NamingExceptions. Not sure how it might cause this problem, but it's not impossible.

                Nevertheless, the actual problem is probably something else. You are indeed getting an exception which is causing Spring LDAP to try to convert that Exception to its own Exception hierarch, which seems to fail.

                Could you try wrapping your search with a try/catch(Throwable) and check the full actual stacktrace? Also, it might be useful to try setting a breakpoint inside of translateNamingException to check what the actual exception is.

                Comment


                • #9
                  I have it working now....

                  I had both a 1.1.2 jar and a 1.2RC1 jar in my project. DUH!!

                  Thanks for your time though.

                  Comment

                  Working...
                  X