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

[GR-46741] NoClassDefFoundError thrown on the JVM but not with native image #6691

Closed
sdeleuze opened this issue May 26, 2023 · 3 comments
Closed
Assignees
Labels
bug native-image spring spring related issue

Comments

@sdeleuze
Copy link
Collaborator

When a class constructor uses another class not present in the classpath, getDeclaredConstructors throws a NoClassDefFoundError on the JVM while on native, when related reflection config is specified, no exception is thrown and no constructor is found. This prevents proper support of agent testing in Spring, see spring-projects/spring-framework#30511 related issue. I would expect consistent behavior between JVM and native, so native versions throws a NoClassDefFoundError too.

Steps to reproduce the issue
The attached repro works on the JVM with ./gradlew test and fails on native with ./gradlew nativeTest.
repro.zip

Describe GraalVM and your environment:
Reproduced with GraalVM CE 23.0.0-dev-20230522_1321.

@sdeleuze sdeleuze added bug native-image spring spring related issue labels May 26, 2023
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue May 26, 2023
This commit refines how GraalVM tracing agent detection works
for both test and application executions.

It rolls back the introduction of TestAotDetector done in 1113096
and instead updates AotDetector.useGeneratedArtifacts()
to only detect "buildtime" and "runtime" imagecode system
property values by leveraging a new method
NativeDetector.inNativeImage(NativeDetector.Context...).

This commit also adds a workaround for
oracle/graal#6691.

Closes spring-projectsgh-30511
@oubidar-Abderrahim oubidar-Abderrahim self-assigned this Jun 1, 2023
@oubidar-Abderrahim
Copy link
Member

Hi, Thank you for reporting this, we'll take a look into this shortly

@oubidar-Abderrahim
Copy link
Member

Tracked internally on GR 46741

@oubidar-Abderrahim oubidar-Abderrahim changed the title NoClassDefFoundError thrown on the JVM but not with native image [GR-46741] NoClassDefFoundError thrown on the JVM but not with native image Apr 5, 2024
@loicottet
Copy link
Member

This was fixed by #8021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug native-image spring spring related issue
Projects
None yet
Development

No branches or pull requests

3 participants