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

Show nicer error when a @ConfigMapping class exists in the deployment module and set to the runtime phase #43394

Open
gastaldi opened this issue Sep 19, 2024 · 4 comments · May be fixed by #43513
Assignees
Labels
area/config kind/enhancement New feature or request

Comments

@gastaldi
Copy link
Contributor

Description

While creating (see this PR for more context - quarkusio/quarkus-workshops#600), I noticed that the following error is thrown when the @ConfigMapping phase is set to RUN_TIME:

Caused by: java.lang.ClassNotFoundException: io.quarkus.workshop.superheroes.version.deployment.VersionConfig
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:533)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:481)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:533)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:481)
	at io.quarkus.runtime.configuration.AbstractConfigBuilder.withMapping(AbstractConfigBuilder.java:64)
	... 21 more

The solution was to move the @ConfigMapping to the runtime module, but the error message is a bit cryptic.

Implementation ideas

It would be nice if we could detect that somehow and display a nicer error message

@gastaldi gastaldi added the kind/enhancement New feature or request label Sep 19, 2024
Copy link

quarkus-bot bot commented Sep 19, 2024

/cc @radcortez (config)

Copy link

quarkus-bot bot commented Sep 19, 2024

You added a link to a Zulip discussion, please make sure the description of the issue is comprehensive and doesn't require accessing Zulip

This message is automatically generated by a bot.

@gastaldi gastaldi changed the title Show nicer error when a @ConfigMapping class exists in the deployment but it is set to be runtime Show nicer error when a @ConfigMapping class exists in the deployment module and set to the runtime phase Sep 19, 2024
@mcruzdev
Copy link
Contributor

I would like to contribute with this one @gastaldi!

@radcortez
Copy link
Member

Feel free to look into it.

This also applies to old @ConfigRoot class objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/enhancement New feature or request
Projects
None yet
3 participants