Announcement Announcement Module
Collapse
No announcement yet.
ClassCastException: LdapCtx cannot be cast to org.springframework.ldap.core.DirContex Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassCastException: LdapCtx cannot be cast to org.springframework.ldap.core.DirContex

    I'm getting a ClassCastException when I try to use spring security + ldap.

    java.lang.ClassCastException: com.sun.jndi.ldap.LdapCtx cannot be cast to org.springframework.ldap.core.DirContextAdapter
    at org.springframework.security.ldap.SpringSecurityLd apTemplate$2.mapFromContext(SpringSecurityLdapTemp late.java:154)
    at org.springframework.ldap.core.ContextMapperCallbac kHandler.getObjectFromNameClassPair(ContextMapperC allbackHandler.java:63)
    at org.springframework.ldap.core.CollectingNameClassP airCallbackHandler.handleNameClassPair(CollectingN ameClassPairCallbackHandler.java:50)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:276)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:234)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:583)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:497)
    at org.springframework.security.ldap.SpringSecurityLd apTemplate.searchForSingleAttributeValues(SpringSe curityLdapTemplate.java:170)
    at org.springframework.security.ldap.populator.Defaul tLdapAuthoritiesPopulator.getGroupMembershipRoles( DefaultLdapAuthoritiesPopulator.java:206)
    at org.springframework.security.ldap.populator.Defaul tLdapAuthoritiesPopulator.getGrantedAuthorities(De faultLdapAuthoritiesPopulator.java:179)
    at com.indigobio.lola.util.GroupRoleMapLdapAuthoritit esPopulator.getGrantedAuthorities(GroupRoleMapLdap AuthorititesPopulator.java:45)
    at org.springframework.security.providers.ldap.LdapAu thenticationProvider.loadUserAuthorities(LdapAuthe nticationProvider.java:243)
    at org.springframework.security.providers.ldap.LdapAu thenticationProvider.authenticate(LdapAuthenticati onProvider.java:231)
    at org.springframework.security.providers.ProviderMan ager.doAuthentication(ProviderManager.java:188)
    at org.springframework.security.AbstractAuthenticatio nManager.authenticate(AbstractAuthenticationManage r.java:46)
    at org.springframework.security.ui.basicauth.BasicPro cessingFilter.doFilterHttp(BasicProcessingFilter.j ava:139)
    at org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
    at org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
    at org.springframework.security.ui.logout.LogoutFilte r.doFilterHttp(LogoutFilter.java:89)
    at org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
    at org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
    at org.springframework.security.context.HttpSessionCo ntextIntegrationFilter.doFilterHttp(HttpSessionCon textIntegrationFilter.java:235)
    at org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
    at org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
    at org.springframework.security.util.FilterChainProxy .doFilter(FilterChainProxy.java:175)
    at org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:236)
    at org.springframework.web.filter.DelegatingFilterPro xy.doFilter(DelegatingFilterProxy.java:167)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
    at org.apache.catalina.valves.CometConnectionManagerV alve.invoke(CometConnectionManagerValve.java:248)
    at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:568)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128)
    at com.springsource.server.servlet.tomcat.internal.St andardApplicationNameTracker$ApplicationNameTracki ngValve.invoke(StandardApplicationNameTracker.java :99)
    at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:568)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:845)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:354)
    at com.springsource.server.concurrent.core.ExecutorSe rviceDelegate$StatisticsGatheringRunnable.run(Exec utorServiceDelegate.java:137)
    at com.springsource.server.concurrent.core.ServerThre adPoolExecutor$1.run(ServerThreadPoolExecutor.java :145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:637)


    Line 45 of GroupRoleMapLdapAuthorititesPopulator.java is
    GrantedAuthority[] grantedAuthorities = ldapAuthoritiesPopulator.getGrantedAuthorities(use r, username);
    where ldapAuthoritiesPopulator is an instance of DefaultLdapAuthoritiesPopulator.

    springsource-dm-server-1.0.2.SR02
    org.springframework.security.core_2.0.5.RELEASE
    org.springframework.ldap_1.2.1.A

    Any ideas?

  • #2
    Hmmm. This doesn't look particularly related to dm Server. I'd guess the problem is in the application. ;-) You may like to try a Spring (Security) forum to see if anyone else has seen this.

    Comment

    Working...
    X