java.lang.ClassCastException

Spring JIRA | anand ramadurg | 7 years ago
  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 | 7 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 | 7 years ago | anand ramadurg
    java.lang.ClassCastException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    ClassCastException : PortableRemoteObject.

    Oracle Community | 1 decade ago | 403765
    java.lang.ClassCastException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    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