Spring LDAP and exporting the service [message #640211] |
Fri, 19 November 2010 10:33  |
Eclipse User |
|
|
|
Hi there,
currently I'm using Spring LDAP 1.3.0 for a module. I've build a service which simply returns all ldap groups as a List<Group> where Group is an interface which is provided in my context. Now something weird happens, if I export the ldap service.
<osgi:reference ref="ldapService" interface="eu.gue.LdapService" />
The service is consumed by the second package but here my problem starts, everytime I try to trigger a service method I recieve this kind of exception
java.lang.ClassCastException: com.sun.jndi.ldap.LdapCtx cannot be cast to org.springframework.ldap.core.DirContextOperations
org.springframework.ldap.core.support.AbstractContextMapper.mapFromContext(AbstractContextMapper.java:43)
org.springframework.ldap.core.ContextMapperCallbackHandler.getObjectFromNameClassPair(ContextMapperCallbackHandler.java:67)
org.springframework.ldap.core.CollectingNameClassPairCallbackHandler.handleNameClassPair(CollectingNameClassPairCallbackHandler.java:50)
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:297)
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:237)
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:624)
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:535)
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:462)
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:483)
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:503)
I've got several other services running in my application which are working as intended. Why I'm receiving this exception here?
Adding the spring ldap bundle to the consuming service doesn't resolve the problem.
|
|
|
|
Re: Spring LDAP and exporting the service [message #640914 is a reply to message #640211] |
Tue, 23 November 2010 09:32  |
Eclipse User |
|
|
|
Onur,
Did you end up re-bundling spring-ldap 1.3.0? If you got that package from http://ebr.springsource.com/repository/app/bundle/version/de tail?name=org.springframework.ldap&version=1.3.0.RELEASE (Spring Source Bundle Repository) it limits version range for Spring Framework imports to [2.5.6.SEC01, 3.0.0). That is excluding Spring 3.x.
When I ended up re-bundling the ldap jar to get it to work with 3.x Spring, I set resolution to optional on com.sun.jndi.ldap.
Seems to work fine here with both OpenLDAP and ActiveDirectory. We are using it through SpringSecurity.
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Spring LDAP
Bundle-Vendor: SpringSource
Bundle-Version: 1.3.0.RELEASE
Bundle-SymbolicName: thirdparty.org.springframework.ldap
Import-Template: com.sun.jndi.ldap;version="0";resolution:=optional,
org.apache.commons.lang.*;version="[2.3.0, 3.0.0)",
org.apache.commons.logging;version="[1.0.4, 2.0.0)",
org.apache.commons.pool.*;version="[1.3.0, 2.0.0)";resolution:="optional",
org.springframework.*;version="${spring.version.range}"
Implementation-Title: Spring LDAP Core
Implementation-Version: 1.3.0.RELEASE
Spring-LDAP-Version: 1.3.0.RELEASE
Implementation-Vendor-Id: org.springframework.ldap
Regards,
Dmitry
|
|
|
Powered by
FUDForum. Page generated in 0.03340 seconds