0 Replies Latest reply on Dec 22, 2010 9:40 AM by Jonathan Tellier

    Problem with ServiceMix InitialContextWrapper

    Jonathan Tellier Newbie



      I've got an application that uses javax.naming.ldap classes to connect to an LDAP directory and I've got the error that is described in this bug report:




      According to the bug report, the problem should be fixed, but I am nevertheless encountering the problem. I can see a difference in the bug report and my situation though: in my application the LDAP calls are not made from within JAAS, but by manually querying the LDAP directory.


      Furthermore, as mentioned on this forums post:




      a workaround for ESB-834 is to stop the Apache ServiceMix Naming bundle. Now, since ESB-834 has been resolved has fixed, but the temporary solution works for me, there's either something that I'm doing wrong or that I don't understand, or the bug is not completely fixed.


      -EDIT 2-

      I've been searching for documentation about the Apache ServiceMix Naming bundle, but could not find much. Basically, I'd like to know what could be the consequences of stopping it. Could someone either point me to relevant documentation or give me some quick explanations about this bundle?

      -END EDIT 2-


      Maybe I should also mention that accessing my LDAP directory from within the same application, but by using Novell's jldap library instead of classes from the javax.naming.ldap works flawlessly.


      Does anyone have an idea about what I might be doing wrong?






      I've taken a closer look at the code and I think I see why I get the error.


      First, the Apache ServiceMix Naming Bundle registers a new javax.naming.spi.InitialContextFactoryBuilder provider for JNDI. When this factory is queried by the javax.naming.ldap.InitialLdapContext to get the initial context, it returns a InitialContextWrapper, which implements only javax.naming.directory.DirContext. Since javax.naming.ldap.InitialLdapContext expects a javax.naming.ldap.LdapContext, the exception mentioned in ESB-834 is raised.


      Does that make sense or am I still missing something?

      -END EDIT-


      Edited by: jtellier on Dec 22, 2010 2:34 PM