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

[Native Image] NullPointer in Method.invoke #10197

Open
1 of 2 tasks
allardbe-sla opened this issue Nov 29, 2024 · 3 comments
Open
1 of 2 tasks

[Native Image] NullPointer in Method.invoke #10197

allardbe-sla opened this issue Nov 29, 2024 · 3 comments
Assignees

Comments

@allardbe-sla
Copy link

Describe the Issue

I have a spring-boot application. That application make use of 'prototype beans' (objects created in runtime). I instantiate them over an injected ObjectProvider in a singleton bean.

The first time I tried, I got a MissingReflectionRegistrationError with the proper data over my prototype bean factory-method. However, once I added that data in a reflect-config.json file in the Exception just became a NullPointerException.

Here the trace:

Caused by: java.lang.NullPointerException: null
        at [email protected]/java.lang.reflect.Method.invoke(Method.java:580)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644)
        ... 25 common frames omitted

The MethodAccessor seems to be null, but I don't know why.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

Tried with the latest JDK11, and then with the current 23

Operating System and Version

bullseye-20240926-slim

Troubleshooting Confirmation

Run Command

/app

Expected Behavior

just runs

Actual Behavior

crashed

Steps to Reproduce

  1. build image with maven spring-boot plugin
  2. start image

Additional Context

I'd be glad to provide more if I knew what is relevant.

Run-Time Log Output and Error Messages

No response

@selhagani
Copy link
Member

Hi @allardbe-sla,
Thank you for reaching out to us.
Perhaps there are more things that you need to add to your configuration file. To be sure, could you please try using the tracing agent which will allow you to generate the reflection metadata dynamically.

@allardbe-sla
Copy link
Author

Hi,
thanks for the hint, I hadn't tried as I thought the other bits where irrelevant for my problem. I now copied the whole generated directory in my project, the generated binary is a bit bigger, but still, the same error occurred.

I also tried building in -diagnostic-mode, I had hoped to get more logging in runtime with it, but that didn't helped either.

Let me know what Information I could provide to you next.

@selhagani
Copy link
Member

could you please share with us a concise reproducer for your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants