-
Sep 21st, 2010, 06:36 AM
#1
UnknownHostException when connecting to LDAP server
Hi All,
I am new to LDAP, I managed to connect to the server and retrieved some data.
When I use the following I get an exception:
contextSource.setBase("DC=miislab,DC=root,DC=miisr oot,DC=com");
Stack trace:
Exception in thread "main" org.springframework.ldap.PartialResultException: nested exception is javax.naming.PartialResultException [Root exception is javax.naming.CommunicationException: DomainDnsZones.miislab.root.miisroot.com:389 [Root exception is java.net.UnknownHostException: DomainDnsZones.miislab.root.miisroot.com]]
at org.springframework.ldap.support.LdapUtils.convert LdapException(LdapUtils.java:203)
at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:315)
at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:237)
at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:588)
at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:546)
at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:401)
at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:421)
at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:441)
at com.vodafone.ldap.LDAPBluePrint.autho(LDAPClass.ja va:51)
at com.vodafone.ldap.LDAPClass.main(LDAPClass.java:87 )
Caused by: javax.naming.PartialResultException [Root exception is javax.naming.CommunicationException: DomainDnsZones.miislab.root.miisroot.com:389 [Root exception is java.net.UnknownHostException: DomainDnsZones.miislab.root.miisroot.com]]
at com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImp l(Unknown Source)
at com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(Un known Source)
at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:295)
... 8 more
Caused by: javax.naming.CommunicationException: DomainDnsZones.miislab.root.miisroot.com:389 [Root exception is java.net.UnknownHostException: DomainDnsZones.miislab.root.miisroot.com]
at com.sun.jndi.ldap.LdapReferralContext.<init>(Unkno wn Source)
at com.sun.jndi.ldap.LdapReferralException.getReferra lContext(Unknown Source)
at com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreRef errals(Unknown Source)
... 11 more
Caused by: java.net.UnknownHostException: DomainDnsZones.miislab.root.miisroot.com
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.sun.jndi.ldap.Connection.createSocket(Unknown Source)
at com.sun.jndi.ldap.Connection.<init>(Unknown Source)
at com.sun.jndi.ldap.LdapClient.<init>(Unknown Source)
at com.sun.jndi.ldap.LdapClient.getInstance(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.connect(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.<init>(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(Unkno wn Source)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstanc e(Unknown Source)
at com.sun.jndi.url.ldap.ldapURLContextFactory.getObj ectInstance(Unknown Source)
at javax.naming.spi.NamingManager.getURLObject(Unknow n Source)
at javax.naming.spi.NamingManager.processURL(Unknown Source)
at javax.naming.spi.NamingManager.processURLAddrs(Unk nown Source)
at javax.naming.spi.NamingManager.getObjectInstance(U nknown Source)
... 14 more
While it worked just fine when I used:
contextSource.setBase("DC=DomainDnsZones,DC=miisla b,DC=root,DC=miisroot,DC=com);
I have 4 base DNs from the root DSE
Could someone help? Thanks in advance
-
Sep 21st, 2010, 06:53 AM
#2
In case someone got stuck I found the solution
ldapTemplate.setIgnorePartialResultException(true) ;
or
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate" >
<property name="ignorePartialResultException" value="true"></property>
<constructor-arg ref="contextSource" />
</bean>
Regards
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules