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

Configuration file cannot be found in Graalvm native image #349

Closed
sergio11 opened this issue Oct 23, 2022 · 2 comments
Closed

Configuration file cannot be found in Graalvm native image #349

sergio11 opened this issue Oct 23, 2022 · 2 comments
Labels
wontfix This will not be worked on

Comments

@sergio11
Copy link

Hi,

Thanks for this great library,

I'm integrating it into my Ktor project which will run as a native Graalvm image.

I'm using theses dependencies:

implementation("com.sksamuel.hoplite:hoplite-core:$hoplite_core_version")
implementation("com.sksamuel.hoplite:hoplite-yaml:$hoplite_core_version")

I have the following application.yml

image

I have integrated the following configuration in order to make the yml files available in the binary

  buildArgs.add("-H:+ReportExceptionStackTraces")
  buildArgs.add("-H:IncludeResources='.*(yml|xml)$'")
  buildArgs.add("-H:Log=registerResource:5")
  imageName.set("mfa_graalvm_service")

At the time of starting the microservice and instantiating the configuration Koin module, the application crashes because it cannot find the application.yml file

val configModule = module {
    single<AppConfig> {
        ConfigLoaderBuilder.default()
            .addResourceSource("/application.yml")
            .strict()
            .build()
            .loadConfigOrThrow()
    }
    single { get<AppConfig>().mfa }
    single { get<AppConfig>().redis }
    single { get<AppConfig>().auth }
}

Could you tell me if I have to apply any additional configuration so that the library finds the configuration file?

Thank so much, Greetings

@sksamuel
Copy link
Owner

sksamuel commented Dec 5, 2022

addResource uses the JVM based class loader. Does this still work with Graal ?

@stale
Copy link

stale bot commented Mar 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 18, 2023
@stale stale bot closed this as completed Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants