External LDAP JNDI connectivity using Tomcat -
i wanted know how external ldap connected using jndi configuration in tomcat.
my code like
try { initialcontext inictx = new initialcontext(); ctx = (ldapcontext) inictx.lookup("external/ldap/worker"); //system.out.println("ldap context initialized::"+ctx); if(ctx!=null) { urlprovider=ctx.getenvironment().get("java.naming.provider.url").tostring(); } } grab (namingexception ne) { throw new namingexception(ne.tostring()); } my context.xml in tomcat has next entry
<resource usedatasourcefactory="true" name="external/ldap/worker" auth="container" type="com.sun.jndi.ldap.ldapctxfactory" java.naming.factory.initial="com.sun.jndi.ldap.ldapctxfactory" java.naming.provider.url="ldap://corpt605.corporate.***.***:13891" java.naming.security.authentication="simple" java.naming.security.principal="uid=cpasysuser,ou=******,o=***.com" java.naming.security.credentials="*********" /> and web.xml has next entry
<resource-ref> <description>e2k ldap datasource example</description> <res-ref-name>external/ldap/worker</res-ref-name> <res-type>com.sun.jndi.ldap.ldapctxfactory</res-type> <res-auth>container</res-auth> </resource-ref> when utilize jndi datasource next error:
08 oct 2014 10:12:03,394 error waveset.ge.commons.ldapjndiconnection_cdi:52 - getldapcntxt::error occured during ldap context lookupjavax.naming.namenotfoundexception: name [external/ldap/worker] not bound in context. unable find [external].
what wrong?
tomcat ldap jndi
No comments:
Post a Comment