Skip to content

Class cast exception when deserializing in Spring #1

Open
@danomatic

Description

@danomatic

When using @Cacheable in a ThreadPoolExecutor, the deserialize is failing. It looks like this:

java.lang.ClassCastException: com.company.SomeBean cannot be cast to com.company.SomeBean
	at com.company.services.SomeService$$EnhancerBySpringCGLIB$$a724921e.getData(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions