Skip to content
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

NoClassDefFound when using with spring data redis #392

Open
MehrCurry opened this issue Jan 23, 2023 · 3 comments
Open

NoClassDefFound when using with spring data redis #392

MehrCurry opened this issue Jan 23, 2023 · 3 comments
Labels
analysis external External parties or components involved

Comments

@MehrCurry
Copy link

I am trying to use UOM together with spring data redis to persist some values.

When saving the Object i always get the following error:

Caused by: java.lang.NoClassDefFoundError: IllegalName: tech.units.indriya.unit.ProductUnit$$Lambda$1208/0x0000000801204e70_Accessor_5hp3zf
	at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:886) ~[na:na]
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:506) ~[spring-core-6.0.3.jar:6.0.3]

Any hints how it is meant to be serialized?

I am using Spring Boot 3 on Java 17 with Indriya 2.1.3.

@keilw
Copy link
Member

keilw commented Jan 23, 2023

Can you share more details or code snippets to reproduce?
It might be a problem of Spring and reflection under Java 17, there are some things that got more restrictive with every version. Did you ask the Spring Framework Core team about the error in ReflectUtils?
ProductUnit inherits from AbstractUnit which is Serializable, so there is no serialization issue as such.

@andi-huber Any idea what the $$Lambda$$ might mean, because at least inside ProductUnit itself I could not see lambda expressions either.

@keilw keilw added analysis external External parties or components involved labels Jan 23, 2023
@andi-huber
Copy link
Member

Could be CGLIB related. Which I thought is no longer recommended to be used.

@keilw
Copy link
Member

keilw commented Jan 23, 2023

Thanks for the input @andi-huber, then @MehrCurry could you please ask the Spring team why they're still using CGLIB and if there is another option you may try?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analysis external External parties or components involved
Projects
None yet
Development

No branches or pull requests

3 participants