i am trying to connect to ldap active directory on windows server 2008 using spring ldap 1.3.1.RELEASE
and ldap config is as follows:
- ldap url is: ldap://dc.fabrikam.com
- username: administrator
- password: 123456
- spring ldap configuration is as follows:
- LDAPContactDAO:Code:<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource"> <property name="url" value="ldap://dc.fabrikam.com" /> <property name="base" value="dc=fabrikam,dc=com" /> <property name="userDn" value="CN=administrator,CN=Users,DC=fabrikam,DC=com" /> <property name="password" value="123456" /> <property name="baseEnvironmentProperties"> <map> <entry key="java.naming.referral"> <value>follow</value> </entry> </map> </property> </bean> <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate"> <constructor-arg ref="contextSource" /> </bean>
-debugs before the exception:Code:@Service public class LDAPContactDAO implements ContactDAO { @Autowired private LdapTemplate ldapTemplate; public List getAllContactNames() { return ldapTemplate.search("", "(objectclass=person)", new AttributesMapper() { public Object mapFromAttributes(Attributes attrs) throws NamingException { return attrs.get("cn").get(); } }); } }
when trying to use the getAllContactNames method, i am getting the following exception:Code:2012-12-31/15:50:36.425 [localhost-startStop-1] DEBUG AuthenticationSource not set - using default implementation 2012-12-31/15:50:36.428 [localhost-startStop-1] DEBUG Not using LDAP pooling 2012-12-31/15:50:36.428 [localhost-startStop-1] DEBUG Trying provider Urls: ldap://192.168.1.118/dc=fabrikam,dc=com 2012-12-31/15:50:37.558 [http-bio-8080-exec-5] DEBUG Got Ldap context on server 'ldap://192.168.1.118/dc=fabrikam,dc=com
Code:org.springframework.ldap.CommunicationException: fabrikam.com.com:389; nested exception is javax.naming.CommunicationException: fabrikam.com.com:389 [Root exception is java.net.ConnectException: Connection timed out: connect]
please advise.


Reply With Quote
