Skip to content

SerializableTypeProxy cannot be deserialized #30165

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

Closed
mira-silhavy opened this issue Mar 22, 2023 · 4 comments
Closed

SerializableTypeProxy cannot be deserialized #30165

mira-silhavy opened this issue Mar 22, 2023 · 4 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression)

Comments

@mira-silhavy
Copy link

mira-silhavy commented Mar 22, 2023

Hi,
we're trying to use Tomcat Session serialization into Redis. The de/serialization process is failing because we save into Session some of our config classes that are part of our Wicket web module.
The problem is that part of the data is SpringBean annotated field in one of the classes. Wicket uses it's own component injector that handles de/serialization process for those beans bean into proxy by calling the Spring code in org/springframework/core/SerializableTypeWrapper.java:126. Wicket @SpringBean annotation allows de/serialization of the fields by using the mentioned code.

I can see that it creates a proxy that implements following classes

Class<?>[] interfaces = new Class<?>[] {type, SerializableTypeProxy.class, Serializable.class};

But when the session is deserialized we get following exception. We debugged the code and found the problematic non-public interface is SerializableTypeProxy. I'd like ask if the class could be made public to fix the issues we have?

Caused by: java.lang.IllegalArgumentException: non-public interface is not defined by the given loader
	at java.base/java.lang.reflect.Proxy$ProxyBuilder.mapToModule(Proxy.java:818)
	at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:651)
	at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$1(Proxy.java:440)
	at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329)
	at java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205)
	at java.base/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:438)
	at java.base/java.lang.reflect.Proxy.getProxyClass(Proxy.java:398)
	at org.redisson.codec.CustomObjectInputStream.resolveProxyClass(CustomObjectInputStream.java:59)
	at java.base/java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1956)
	at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1897)
	at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2224)
	at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
	at java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2606)
	at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2457)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 22, 2023
@oliverhenlich
Copy link

Seems similar to this issue
spring-projects/spring-data-redis#2016

@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Mar 27, 2023
@jhoeller jhoeller self-assigned this Nov 25, 2023
@jhoeller
Copy link
Contributor

What's the actual ClassLoader this is getting deserialized into? In that target ClassLoader arrangement, where are the Spring classes defined - in a parent ClassLoader, I assume?

Declaring SerializableTypeProxy is not entirely simple since it and its TypeProvider delegate are nested interfaces in the non-public SerializableTypeWrapper. We'd have to move it to a top-level public type itself which we are rather reluctant to do.

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Dec 22, 2023
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Dec 29, 2023
@spring-projects-issues
Copy link
Collaborator

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2024
@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression)
Projects
None yet
Development

No branches or pull requests

6 participants