I'm extensively using groovy classes in my web app project. I can create an instance of a type (defined as a groovy class) but can never at a later time cast back to it (GroovyCastException
occurs).
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.company.role.delegation.ProfileModel@49ee6848' with class 'com.company.role.delegation.ProfileModel' to class 'com.company.role.delegation.ProfileModel'
According to the above error message, the source and destination class types are the same. Huh?
Most likely the reason is that the class have been loaded twice via different classloaders. Check if the getClass().getClassLoader() for both the instances are identical.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With