I hava an applicaiton which works fine on Tomcat 7, but on Websphere 8.0 the Spring class org.springframework.ldap.core.LdapTemplate.authenticate throws an ClassCastException.
Any idea's links will be appreciated! \O/
2012-01-12 12:11:39,266 WebContainer : 1 DEBUG com.sentera.fi.slo.webshop.facade.LdapFacade - java.lang.ClassCastException: com.sun.jndi.ldap.LdapCtx incompatible with org.springframework
Pinned topic Websphere 8.0 and Spring LDAP ClassCastException
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-01-25T15:56:14Z at 2012-01-25T15:56:14Z by Condor70
Condor70 0600007KV11 Post
Re: Websphere 8.0 and Spring LDAP ClassCastException2012-01-25T15:56:14ZThis is the accepted answer. This is the accepted answer.Ran into the same problem this week.
Spent way to much time on this but wasn't able to solve the problem, but did find a workaround.
Found this link (http://forum.springsource.org/showthread.php?73576-Getting-ClassCastException-even-when-I-am-not-using-custom-DirObjectFactory&p=246643#post246643) but the solution doesn't seem to work (my context class loader was already set to the EAR loader, so it should be able to find the spring-ldap jar).
spring-ldap specifies an object factory when creating the JDNI LDAP context:
But somehow JNDI isn't able to resolve the classname and reverts to the default object factory (that creates LdapCtx objects).
I think this has something to do with the fact that OSGi is now integrated in WAS8 and that the OSGi classloaders are breaking this.
I finally ended up rewriting my LDAP code so it uses AttributesMapper, BasicAttributes and ModificationItem instead of ContextMapper, DirContextAdapter and DirContextOperations (which is the recommended method for spring-ldap-1.3 anyway).