Hi thusitha, On 21 Jan 2018 1:18 pm, "Thusitha Thilina Dayaratne" < thusithathil...@gmail.com> wrote:
Hi Rukshan, Does your environment contains anything or is it a just empty map? Yes it contain the ldap context factory and other connection url and credentials data. Thanks Thusitha On Sun, Jan 21, 2018 at 3:35 AM, Rukshan Premathunga <ruks...@wso2.com> wrote: > Hi All, > > Recently we started to write a LDAP client and observed following > exception when i create context instance. > context = new InitialDirContext(environment); > > Error obtaining connection. Cannot find the InitialContextFactory > com.sun.jndi.ldap.LdapCtxFactory. javax.naming.NoInitialContextException: > Cannot find the InitialContextFactory com.sun.jndi.ldap.LdapCtxFactory. > at org.wso2.carbon.jndi.internal.osgi.JNDIContextManagerImpl.la > mbda$getInitialContextInternal$20(JNDIContextManagerImpl.java:118) > at java.util.Optional.orElseThrow(Optional.java:290) > at org.wso2.carbon.jndi.internal.osgi.JNDIContextManagerImpl.ge > tInitialContextInternal(JNDIContextManagerImpl.java:118) > at org.wso2.carbon.jndi.internal.osgi.JNDIContextManagerImpl.ne > wInitialContext(JNDIContextManagerImpl.java:68) > at org.wso2.carbon.jndi.internal.osgi.factory.DefaultContextFac > tory.lambda$getInitialContext$23(DefaultContextFactory.java:68) > at org.wso2.carbon.jndi.internal.util.LambdaExceptionUtils.lamb > da$rethrowFunction$4(LambdaExceptionUtils.java:120) > at java.util.Optional.map(Optional.java:215) > at org.wso2.carbon.jndi.internal.osgi.factory.DefaultContextFac > tory.getInitialContext(DefaultContextFactory.java:68) > at javax.naming.spi.NamingManager.getInitialContext(NamingManag > er.java:684) > > > I was able to get the context successfully using following workaround. But > since it is not the proper way can we have a way to solve this issue? It > seems carbon jndi cannot find the LdapCtxFactory. > > LdapCtxFactory.getLdapCtxInstance(environment.get(Context.PROVIDER_URL), > environment); > > > Thanks and Regards > > -- > Rukshan Chathuranga. > Software Engineer. > WSO2, Inc. > +94711822074 <071%20182%202074> > > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > --
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev