LDAP Serach Error - NotContextException
Hi All,
We are upgarding from CQ5.6.1 to AEM 6.2. In the earlier version we had a code that search the content of Ldap using javax.naming.directory* classes.
Like the way
DirContext ctx = new InitialDirContext(env); //Creating context NamingEnumeration<SearchResult> ldapResults = ctx.search(base.get(), filter, sc); //Calling search method with arguments, this line throws Exception
When we are running the same code in AEM 6.2, getting the error.
javax.naming.NotContextException: Not an instance of DirContext at javax.naming.directory.InitialDirContext.getURLOrDefaultInitDirCtx(InitialDirContext.java:111) at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:267)
Any one faced this issue? The only difference I know is that in Cq5.6.1, we used to do the LDAP configs at server level, in AEm 6.2 they are available in OSGI configs.
Note:- We are defaining the LDAP enviornment varaibles in the Java class as well where we are getting the exception
Thanks
Monika






