[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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] ImportBeanDefinitionRegistrar not load the bean #10277

Open
1 task
tadlakha9 opened this issue Dec 10, 2024 · 5 comments
Open
1 task

[Native Image] ImportBeanDefinitionRegistrar not load the bean #10277

tadlakha9 opened this issue Dec 10, 2024 · 5 comments
Assignees

Comments

@tadlakha9
Copy link
tadlakha9 commented Dec 10, 2024

Describe the Issue

We have a scenario where we are loading a bean using a custom annotation with the help of ImportBeanDefinitionRegistrar but bean is not loaded and we are getting below exception

image

Gradle bootRun task is working fine.

We have generated an executable(working fine), now while running the executable we are getting the issue, we are using graalvm 17. Facing the same issue with graalvm 21 and graalvm 23

Please find the reproducer.

practice.zip

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java version "17.0.13" 2024-10-15 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 17.0.13+10.1 (build 17.0.13+10-LTS-jvmci-23.0-b49)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 17.0.13+10.1 (build 17.0.13+10-LTS-jvmci-23.0-b49, mixed mode, sharing)

Operating System and Version

Linux 4.18.0-372.105.1.el8_6.x86_64 #1 SMP x86_64 GNU/Linux

Build Command

gradle nativeRun

Expected Behavior

our expectation is that the bean to be loaded while using ImportBeanDefinitionRegistrar

Actual Behavior

executable is generated perfectly fine, issue only while running the executable.

Steps to Reproduce

  1. gradle nativeRun : this is the command we can use to reproduce the issue.

Additional Context

No response

Build Log Output and Error Messages


APPLICATION FAILED TO START


Description:

Parameter 0 of constructor in com.example.practice.service.CustomerService required a bean of type 'com.example.practice.client.CustomerClient' that could not be found.

Action:

Consider defining a bean of type 'com.example.practice.client.CustomerClient' in your configuration.

@selhagani
Copy link
Member

Hi @tadlakha9,
Thank you for reaching out to us!

Could you please try generating the metadata configuration files using the tracing agent? This could solve the issue that you're facing.
I see that you're using gradle so this documentation should help you.

@tadlakha9
Copy link
Author

Hello @selhagani

Thanks for replying.

yes we have followed the mentioned document and generate the metadata configuration file using the tracing agent, we have placed the generated reflect-config.json file inside \src\main\resources\META-INF\native-image and also added some more configuration which was not added by tracing agent automatically, but the error didn't resolve.

@selhagani
Copy link
Member

I'm afraid I can't use the zip file you attached as a reproducer to investigate this issue any further. Could you please add your reproducer to a github repo and share it with me please?

@tadlakha9
Copy link
Author

I'm afraid I can't use the zip file you attached as a reproducer to investigate this issue any further. Could you please add your reproducer to a github repo and share it with me please?

Here you can find the reproducer

@selhagani
Copy link
Member

When trying to reproduce the issue I got the following error:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
I am using Gradle 8.11.1
Perhaps we are using different Gradle versions?

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