org.springframework.security.authentication.InternalAuthenticationServiceException: Cannot cast object 'User(email:user@example.com)' with class 'com.test.User' to class 'com.test.User'

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 Shashank Agrawal
, 1 year ago
Cannot cast object 'User(email:user@example.com)' with class 'com.test.User' to class 'com.test.User'
via Stack Overflow by badaboum
, 3 months ago
Object [id=1] was not of the specified subclass [com.vivalio.springmvc.model.User] : Discriminator:
via Stack Overflow by herau
, 2 years ago
An Authentication object was not found in the SecurityContext
via Stack Overflow by We are Borg
, 1 year ago
Provided id of the wrong type for class com.WirTauschen.model.User. Expected: class java.lang.Integer, got class java.lang.String
via Stack Overflow by Supun Wimukthi
, 1 year ago
Could not get JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'supun'@'localhost' (using password: YES)
org.springframework.security.authentication.InternalAuthenticationServiceException: Cannot cast object 'User(email:user@example.com)' with class 'com.test.User' to class 'com.test.User'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:405)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:319)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:232)
at com.test.User.findWhere(User.groovy)
at com.test.User$findWhere.call(Unknown Source)
at grails.plugin.springsecurity.userdetails.GormUserDetailsService.$tt__loadUserByUsername(GormUserDetailsService.groovy:60)
at grails.plugin.springsecurity.userdetails.GormUserDetailsService$_loadUserByUsername_closure1.doCall(GormUserDetailsService.groovy)

Users with the same issue

Once, 6 months ago
3 times, 11 months ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Once, 5 months ago
17 more bugmates

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