java.lang.ClassCastException: java.lang.String cannot be cast to com.mycompany.myproject.types.MyType

Stack Overflow | diminuta | 7 months 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

    DozerConverter complaining about equals method in one of the classes

    Stack Overflow | 7 months ago | diminuta
    java.lang.ClassCastException: java.lang.String cannot be cast to com.mycompany.myproject.types.MyType

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.String cannot be cast to com.mycompany.myproject.types.MyType

      at com.mycompany.myproject.types.MyType.equals()
    2. com.mycompany.myproject
      MyType.equals
      1. com.mycompany.myproject.types.MyType.equals(MyType.java:95)
      1 frame
    3. Dozer
      DozerBeanMapper.map
      1. org.dozer.converters.PrimitiveOrWrapperConverter.convert(PrimitiveOrWrapperConverter.java:63)
      2. org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:449)
      3. org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:361)
      4. org.dozer.MappingProcessor.mapField(MappingProcessor.java:307)
      5. org.dozer.MappingProcessor.map(MappingProcessor.java:267)
      6. org.dozer.MappingProcessor.mapToDestObject(MappingProcessor.java:216)
      7. org.dozer.MappingProcessor.createByCreationDirectiveAndMap(MappingProcessor.java:196)
      8. org.dozer.MappingProcessor.mapCustomObject(MappingProcessor.java:512)
      9. org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:465)
      10. org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:361)
      11. org.dozer.MappingProcessor.mapField(MappingProcessor.java:307)
      12. org.dozer.MappingProcessor.map(MappingProcessor.java:267)
      13. org.dozer.MappingProcessor.mapToDestObject(MappingProcessor.java:216)
      14. org.dozer.MappingProcessor.createByCreationDirectiveAndMap(MappingProcessor.java:196)
      15. org.dozer.MappingProcessor.mapGeneral(MappingProcessor.java:170)
      16. org.dozer.MappingProcessor.map(MappingProcessor.java:104)
      17. org.dozer.MappingProcessor.map(MappingProcessor.java:99)
      18. org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:120)
      18 frames
    4. com.mycompany.myproject
      AnotherClass.oneMethod
      1. com.mycompany.myproject.mypackage.AnotherClass.oneMethod(AnotherClass.java:60)
      1 frame