1 2 Previous Next 20 Replies Latest reply on Dec 20, 2011 7:58 PM by alllle

    spring ldap in as7

    oourfali

      Hey,

       

      I use spring ldap in order run ldap queries.

      Worked in eap 5.1.

      When I tried to work with as7 I get the following error when querying:

      08:37:30,801 ERROR [org.springframework.ldap.control.AbstractRequestControlDirContextProcessor] (pool-4-thread-1) No matching response control found for paged results - looking for 'class javax.naming.ldap.PagedResultsResponseControl

       

      The spring jars are in <ear>/lib

       

      No other spring ldap errors occur.

       

      The class javax.naming.ldap.PagedResultsResponseControl is a part of the java runtime (rt.jar) so I guess it should be accessible in that point.

       

      Any idea what's the problem?

       

      Thank you,

      Oved

        • 1. Re: spring ldap in as7
          oourfali

          I did some research + debugging, and I saw that the response control is not created at all.

          The error comes when the method getResultsControl of the LdapContext is called, and it returns null.

           

          I think it is some kind of configuration, or class loading issue, that prevents it from happenning.

           

          If anyone managed to make spring ldap work properly when using paged queries in as7 then I'd be happy to hear about it.

           

          Again, in 5.1 it worked properly.

           

          Thank you,

          Oved

          • 2. Re: spring ldap in as7
            dlofthouse

            If the class you can not find it a javax class try updating your Manifest for the war with the following dependency: -

             

            Dependencies: javax.api

            • 3. Re: spring ldap in as7
              oourfali

              It is looking in the response classed for an instance of the class javax.naming.ldap.PagedResultsResponseControl, but it doesn't find it because the response control array is empty.

               

              I tried to add javax.api to the manifest file (both in the jar that uses it, and in the ear manifest), but it didn't work.

              I don't know if he doesn't find this class, or maybe another error is being "swallowed", causing it not to create the response control, and then to fail when looking for an instance of it.

               

              btw, I also tried to add a system module that contains javax.naming.ldap, and add a dependency on it, but it also didn't work.

               

              Thank you for your help,

              Oved

              • 4. Re: spring ldap in as7
                qixunyuan

                do you resolved the problem, right now, I also want to do the same thing with you.

                -----

                I want to set up the CDI service for the ldap access.

                • 5. Re: spring ldap in as7
                  oourfali

                  Not yet.

                  I moved on to other issues I had.

                   

                  In case you'll have it working I'd be happy to hear how.

                  I suspect something in my configuration or environment is wrong, or it is a class loading issue that is maybe caught and thus it is hidden from me.

                  • 6. Re: spring ldap in as7
                    oourfali

                    Hey,

                     

                    I came back to this issue now, and I found the following bug https://issues.jboss.org/browse/AS7-2085

                     

                    It is a blocker for 7.0.2.Final.

                     

                    When is it planned to be released?

                     

                    Thank you,

                    Oved

                    • 7. Re: spring ldap in as7
                      oourfali

                      Well, I saw that it was released, but the problem wasn't fixed.

                       

                      Does anyone know when is this issue planned to be fixed?

                      • 8. Re: spring ldap in as7
                        yuanqixun

                        Hello,everyone,this bug is jboss7.x's problem, I debug into jboss's source code, I fixed it, you should recompile the module:org.jboss.as.naming

                        the problem is caused by class org.jboss.as.naming.NamingContext.java this following code:

                        ---------------------

                            static {
                                try {
                                    NamingManager.setObjectFactoryBuilder(ObjectFactoryBuilder.INSTANCE);
                                } catch(Throwable t) {
                                    ROOT_LOGGER.failedToSet(t, "ObjectFactoryBuilder");
                               }
                            }

                        --------------------

                        you can comment it and rebuild this module, and spring-ldap will run ok.I don't know the reason.

                        good luck.

                        1 of 1 people found this helpful
                        • 9. Re: spring ldap in as7
                          oourfali

                          It indeed solves the problem.

                          I wonder if that's indeed the correct fix to do.

                           

                          Hopefully someone from the jboss team will check it out.

                           

                          Thank you!

                          Oved

                          • 10. Re: spring ldap in as7
                            davidwery

                            Thanks for the fix Yuan! Don't you have the compiled version of the org.jboss.as.naming module? I'm lazy to rebuild it :-)

                             

                            David

                            • 11. Re: spring ldap in as7
                              oourfali

                              The module and index file are attached.

                              Built about a week ago with the latest commits.

                               

                              Enjoy :-)

                              • 12. Re: spring ldap in as7
                                yuanqixun

                                I'm sorry, I'm very busy recently,I attached the source and binary file.

                                • 13. Re: spring ldap in as7
                                  jaikiran

                                  Looking at this thread and the referenced JIRA, I don't really understand what the issue is. I can see that the Spring configuration/runtime is running into some issue but I can't find much details in this thread or the JIRA. Could one of you please post the exact details including the exception stacktrace and also a reproducible application?

                                  • 14. Re: spring ldap in as7
                                    oourfali

                                    I'll try to create a small reproduction application.

                                     

                                    Basically, the problem is that when trying to query an LDAP directory using Spring LDAP each query results in:

                                    org.springframework.ldap.core.ObjectRetrievalException: Binding did not contain any object.

                                     

                                    Yuan found out that remarking the code:

                                    static {
                                        try {
                                            NamingManager.setObjectFactoryBuilder(ObjectFactoryBuilder.INSTANCE);
                                        } catch(Throwable t) {
                                            ROOT_LOGGER.failedToSet(t, "ObjectFactoryBuilder");
                                       }
                                    }

                                     

                                    Solves the problem, but not sure it is the correct fix.

                                    1 2 Previous Next