-
Notifications
You must be signed in to change notification settings - Fork 14
Class cast exception when deserializing in Spring #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you please give us the signature of the method you put the @Cacheable on? As well as the params of the @Cacheable you used? And if you can give us a unit test we can run, it would be even better. |
hello, i have the same issue java.lang.ClassCastException: fr.***.digital.domain.***UserDetails cannot be cast to fr.***.digital.domain.***UserDetails
at fr.***.digital.client.***ConnectClient$$EnhancerBySpringCGLIB$$63ecbbdb.getUserDetails(<generated>)
at fr.***.digital.security.jwt.TokenProvider.getAuthentication***Connect(TokenProvider.java:112)
at fr.***.digital.security.jwt.JWTFilter.doFilter(JWTFilter.java:47)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) This is my method : @Cacheable(value = "getUserInfo", key = "#key")
public ***UserDetails getUserDetails(OAuth2AccessToken token, String key) { And my spring boot config spring:
cache:
mongo:
caches:
-
# TTL (in seconds).
ttl: 600
# MongoDB collection name.
collectionName: userInfoCache
# Cache name for the @Cacheable annotation.
cacheName: getUserInfo
# Value that indicates if the collection must be flushed when the application starts.
flushOnBoot: true |
For information, I have this problem when I use Spring Boot DevTools on my eclipse or when I do ./gradlew bootRun. There is no problem when my application is running on production environment. |
Thanks for your input. Considering my current workload, I won't be able to look into it immediately. But we welcome PRs. |
Hi @danielprplt! I have some questions regarding serialization:
That's all, I'll send a PR if you agree this should be fixed. 😄 |
Hello @sake92,
|
Hi @aymhce did you find a solution on this issue while using eclipse please? |
Sorry, i'm no longer work on the project that needed to use spring-cache-mongodb. However, thank you for issue fixing :) |
@danielprplt @cyrilschumacher do you plan to merge the mentioned pull request ? |
When using
@Cacheable
in aThreadPoolExecutor
, the deserialize is failing. It looks like this:If I write a unit test that just calls the method outside of a thread pool, it seems to work. Do you have any idea why this would happen? Can this library use a custom serializer?
The text was updated successfully, but these errors were encountered: