java.lang.ClassCastException

Spring JIRA | anand ramadurg | 8 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I have configuration something like this, <bean id="contextSourceTarget" class="org.springframework.ldap.core.support.LdapContextSource"> <property name="urls" value="${ldapconnection.urls}" /> <property name="base" value="${ldapconnection.base}" /> <property name="userDn" value="${ldapconnection.userDn}" /> <property name="password" value="${ldapconnection.password}" /> <property name="pooled" value="false"/> <property name="baseEnvironmentProperties"> <map> <entry key="com.sun.jndi.ldap.connect.timeout" value="${ldapconnection.timeout}" /> </map> </property> </bean> <bean id="dirContextValidator" class="org.springframework.ldap.pool.validation.DefaultDirContextValidator" /> <bean id="contextSource" class="org.springframework.ldap.pool.factory.PoolingContextSource"> <property name="contextSource" ref="contextSourceTarget" /> <property name="dirContextValidator" ref="dirContextValidator" /> <property name="testOnBorrow" value="${ldappool.testOnBorrow}" /> <property name="testWhileIdle" value="${ldappool.testWhileIdle}" /> <property name="minIdle" value="${ldappool.minIdle}" /> <property name="maxIdle" value="${ldappool.maxIdle}" /> <property name="maxActive" value="${ldappool.maxActive}" /> <property name="maxWait" value="${ldappool.maxWait}" /> <property name="whenExhaustedAction" value="${ldappool.whenExhaustedAction}" /> <property name="timeBetweenEvictionRunsMillis" value="${ldappool.timeBetweenEvictionRunsMillis}" /> <property name="minEvictableIdleTimeMillis" value="${ldappool.minEvictableIdleTimeMillis}" /> <property name="numTestsPerEvictionRun" value="${ldappool.numTestsPerEvictionRun}" /> </bean> <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate"> <constructor-arg ref="contextSource" /> </bean> <bean id="tripletContextMapper" class="com.anand.MyContextMapper"> <property name="name" value="name" /> </bean> <bean id="ldapSearch" class="com.anand.LDAPSearch"> <property name="searchDn" value="${search.Dn}" /> <property name="tripletContextMapper" ref="tripletContextMapper" /> </bean> </beans> From above, You can see that, I have not configured any DirObjectFactory but still getting ClassCastException as shown below, 1|localhost|MyAdapter|2009-06-16 17:54:49|ldap search error: : null java.lang.ClassCastException at org.springframework.ldap.core.support.AbstractContextMapper.mapFromContext(AbstractContextMapper.java:43) at org.springframework.ldap.core.LdapTemplate$14.executeWithContext(LdapTemplate.java:869) at org.springframework.ldap.core.LdapTemplate.executeWithContext(LdapTemplate.java:784) at org.springframework.ldap.core.LdapTemplate.executeReadOnly(LdapTemplate.java:771) at org.springframework.ldap.core.LdapTemplate.lookup(LdapTemplate.java:865)

    Spring JIRA | 8 years ago | anand ramadurg
    java.lang.ClassCastException
  2. 0

    I have configuration something like this, <bean id="contextSourceTarget" class="org.springframework.ldap.core.support.LdapContextSource"> <property name="urls" value="${ldapconnection.urls}" /> <property name="base" value="${ldapconnection.base}" /> <property name="userDn" value="${ldapconnection.userDn}" /> <property name="password" value="${ldapconnection.password}" /> <property name="pooled" value="false"/> <property name="baseEnvironmentProperties"> <map> <entry key="com.sun.jndi.ldap.connect.timeout" value="${ldapconnection.timeout}" /> </map> </property> </bean> <bean id="dirContextValidator" class="org.springframework.ldap.pool.validation.DefaultDirContextValidator" /> <bean id="contextSource" class="org.springframework.ldap.pool.factory.PoolingContextSource"> <property name="contextSource" ref="contextSourceTarget" /> <property name="dirContextValidator" ref="dirContextValidator" /> <property name="testOnBorrow" value="${ldappool.testOnBorrow}" /> <property name="testWhileIdle" value="${ldappool.testWhileIdle}" /> <property name="minIdle" value="${ldappool.minIdle}" /> <property name="maxIdle" value="${ldappool.maxIdle}" /> <property name="maxActive" value="${ldappool.maxActive}" /> <property name="maxWait" value="${ldappool.maxWait}" /> <property name="whenExhaustedAction" value="${ldappool.whenExhaustedAction}" /> <property name="timeBetweenEvictionRunsMillis" value="${ldappool.timeBetweenEvictionRunsMillis}" /> <property name="minEvictableIdleTimeMillis" value="${ldappool.minEvictableIdleTimeMillis}" /> <property name="numTestsPerEvictionRun" value="${ldappool.numTestsPerEvictionRun}" /> </bean> <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate"> <constructor-arg ref="contextSource" /> </bean> <bean id="tripletContextMapper" class="com.anand.MyContextMapper"> <property name="name" value="name" /> </bean> <bean id="ldapSearch" class="com.anand.LDAPSearch"> <property name="searchDn" value="${search.Dn}" /> <property name="tripletContextMapper" ref="tripletContextMapper" /> </bean> </beans> From above, You can see that, I have not configured any DirObjectFactory but still getting ClassCastException as shown below, 1|localhost|MyAdapter|2009-06-16 17:54:49|ldap search error: : null java.lang.ClassCastException at org.springframework.ldap.core.support.AbstractContextMapper.mapFromContext(AbstractContextMapper.java:43) at org.springframework.ldap.core.LdapTemplate$14.executeWithContext(LdapTemplate.java:869) at org.springframework.ldap.core.LdapTemplate.executeWithContext(LdapTemplate.java:784) at org.springframework.ldap.core.LdapTemplate.executeReadOnly(LdapTemplate.java:771) at org.springframework.ldap.core.LdapTemplate.lookup(LdapTemplate.java:865)

    Spring JIRA | 8 years ago | anand ramadurg
    java.lang.ClassCastException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      No message provided

      at org.springframework.ldap.core.support.AbstractContextMapper.mapFromContext()
    2. spring-ldap-core
      LdapTemplate.lookup
      1. org.springframework.ldap.core.support.AbstractContextMapper.mapFromContext(AbstractContextMapper.java:43)
      2. org.springframework.ldap.core.LdapTemplate$14.executeWithContext(LdapTemplate.java:869)
      3. org.springframework.ldap.core.LdapTemplate.executeWithContext(LdapTemplate.java:784)
      4. org.springframework.ldap.core.LdapTemplate.executeReadOnly(LdapTemplate.java:771)
      5. org.springframework.ldap.core.LdapTemplate.lookup(LdapTemplate.java:865)
      5 frames