|
Class<?> clazz = XReflect.getDeclaredNestedClass(Collections.class, "java.util.Collections$SetFromMap"); |
Description:
While building a native image of a Spring Boot application using GraalVM (v21.0.5, Java 21) and EclipseStore (v2.0.0), I encountered the following error due to SetFromMap:
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field final java.util.Map java.util.Collections$SetFromMap.m accessible...
I've attempted multiple configurations (reflect-config.json, --add-opens, RuntimeHints) without success. A community suggestion pointed out that Eclipse Serializer might rely on reflective access to internal Java classes. Could Serializer adapt to avoid internal class access to ensure compatibility with GraalVM native images?
Steps to Reproduce:
- Add EclipseStore to a Spring Boot application.
- Build with GraalVM native-image.
- Run the native image.
Expected Behavior: No reflection errors in GraalVM native image builds.
Additional Information:
GitHub Repository: LiveNathan/nativeImageTest
Stackoverflow Question: GraalVM native image build fails using EclipseStore
EclipseStore Discussion: Eclipse Store GitHub Discussion #297
Thank you!
serializer/persistence/binary/src/main/java/org/eclipse/serializer/persistence/binary/java/util/BinaryHandlerSetFromMap.java
Line 39 in 6dbcfc8
Description:
While building a native image of a Spring Boot application using GraalVM (v21.0.5, Java 21) and EclipseStore (v2.0.0), I encountered the following error due to
SetFromMap:I've attempted multiple configurations (
reflect-config.json,--add-opens,RuntimeHints) without success. A community suggestion pointed out that Eclipse Serializer might rely on reflective access to internal Java classes. Could Serializer adapt to avoid internal class access to ensure compatibility with GraalVM native images?Steps to Reproduce:
Expected Behavior: No reflection errors in GraalVM native image builds.
Additional Information:
GitHub Repository: LiveNathan/nativeImageTest
Stackoverflow Question: GraalVM native image build fails using EclipseStore
EclipseStore Discussion: Eclipse Store GitHub Discussion #297
Thank you!