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

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Stack Overflow by diminuta
, 1 year ago
java.lang.String cannot be cast to com.mycompany.myproject.types.MyType
java.lang.ClassCastException: java.lang.String cannot be cast to com.mycompany.myproject.types.MyType
at com.mycompany.myproject.types.MyType.equals(MyType.java:95)
at org.dozer.converters.PrimitiveOrWrapperConverter.convert(PrimitiveOrWrapperConverter.java:63)
at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:449)
at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:361)
at org.dozer.MappingProcessor.mapField(MappingProcessor.java:307)
at org.dozer.MappingProcessor.map(MappingProcessor.java:267)
at org.dozer.MappingProcessor.mapToDestObject(MappingProcessor.java:216)
at org.dozer.MappingProcessor.createByCreationDirectiveAndMap(MappingProcessor.java:196)
at org.dozer.MappingProcessor.mapCustomObject(MappingProcessor.java:512)
at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:465)
at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:361)
at org.dozer.MappingProcessor.mapField(MappingProcessor.java:307)
at org.dozer.MappingProcessor.map(MappingProcessor.java:267)
at org.dozer.MappingProcessor.mapToDestObject(MappingProcessor.java:216)
at org.dozer.MappingProcessor.createByCreationDirectiveAndMap(MappingProcessor.java:196)
at org.dozer.MappingProcessor.mapGeneral(MappingProcessor.java:170)
at org.dozer.MappingProcessor.map(MappingProcessor.java:104)
at org.dozer.MappingProcessor.map(MappingProcessor.java:99)
at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:120)
at com.mycompany.myproject.mypackage.AnotherClass.oneMethod(AnotherClass.java:60)

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.

Know the solutions? Share your knowledge to help other developers to debug faster.