Re: [Dev] Carbon JNDI cannot find com.sun.jndi.ldap.LdapCtxFactory
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 Premathungawrote: > 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
Re: [Dev] Carbon JNDI cannot find com.sun.jndi.ldap.LdapCtxFactory
Hi Rukshan, Does your environment contains anything or is it a just empty map? Thanks Thusitha On Sun, Jan 21, 2018 at 3:35 AM, Rukshan Premathungawrote: > 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.lambda$ > getInitialContextInternal$20(JNDIContextManagerImpl.java:118) > at java.util.Optional.orElseThrow(Optional.java:290) > at org.wso2.carbon.jndi.internal.osgi.JNDIContextManagerImpl. > getInitialContextInternal(JNDIContextManagerImpl.java:118) > at org.wso2.carbon.jndi.internal.osgi.JNDIContextManagerImpl. > newInitialContext(JNDIContextManagerImpl.java:68) > at org.wso2.carbon.jndi.internal.osgi.factory. > DefaultContextFactory.lambda$getInitialContext$23( > DefaultContextFactory.java:68) > at org.wso2.carbon.jndi.internal.util.LambdaExceptionUtils. > lambda$rethrowFunction$4(LambdaExceptionUtils.java:120) > at java.util.Optional.map(Optional.java:215) > at org.wso2.carbon.jndi.internal.osgi.factory.DefaultContextFactory. > getInitialContext(DefaultContextFactory.java:68) > at javax.naming.spi.NamingManager.getInitialContext( > NamingManager.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
[Dev] Carbon JNDI cannot find com.sun.jndi.ldap.LdapCtxFactory
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.lambda$getInitialContextInternal$20(JNDIContextManagerImpl.java:118) at java.util.Optional.orElseThrow(Optional.java:290) at org.wso2.carbon.jndi.internal.osgi.JNDIContextManagerImpl.getInitialContextInternal(JNDIContextManagerImpl.java:118) at org.wso2.carbon.jndi.internal.osgi.JNDIContextManagerImpl.newInitialContext(JNDIContextManagerImpl.java:68) at org.wso2.carbon.jndi.internal.osgi.factory.DefaultContextFactory.lambda$getInitialContext$23(DefaultContextFactory.java:68) at org.wso2.carbon.jndi.internal.util.LambdaExceptionUtils.lambda$rethrowFunction$4(LambdaExceptionUtils.java:120) at java.util.Optional.map(Optional.java:215) at org.wso2.carbon.jndi.internal.osgi.factory.DefaultContextFactory.getInitialContext(DefaultContextFactory.java:68) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.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 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev