-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Config root not initialized yet #22684
Comments
This seems to be cause by #17220. The issue here is that Filters are initialised during static init, and the rest client configuration is only available in runtime. Not sure what we can do here. Even if it was working before, because the config instance is not the same between static / runtime, the rest client could be configured differently depending on the phase (for instance if a source would override something between static / runtime). I'm wondering if we should provide the rest client root for static as well (even if it may be different). Any thoughts @TomasHofman? |
As a workaround, the client could be created programatically, but that means that you need to provide the configuration yourself (and the register annotation has to be dropped). |
@radcortez When you say that the filters are initialized during static init does that mean that any custom If you are able to supply a "fake" client during initialization and replace it with the real, runtime-configured one later on I think it's fine as there's no user code running that would use the injected fake. If you'd inject it with something that does not reflect runtime configuration that would be very confusing, straight failure is a better alternative. In any case it would be nice to detect this problem and provide a more explanatory error message that would hint me what to do. |
No. When you run the application we actually create two
Not sure if we have one, but on the REST side, all Providers (like filters) are initialized during static init.
The problem with the new REST Configuration is that the Config Root is marked specifically to be only for runtime (not static). Creating the client programmatically and passing in the configuration manually should work. Maybe wrapping the client in a
Lets have a look into it and see if we can detect such cases to provide a more clear error message. |
We did some further changes to rest client configuration, but I'm not sure which version of quarkus that landed in. The clients' config map was originally loaded as part of the Also, the I will try to do some experiments. |
The idea with encapsulating the client in
|
@TomasHofman Confirmed, thanks a lot! This is a sensible workaround. Now the point of this issue should be improved error message that will suggest that approach. |
I believe we could add an improved message here: |
@radcortez that's a good idea. There is couple of more places I think, plus I will also check the reactive client. I will prepare a PR. @rvansa thanks for confirming and for your input! |
JUST ADD @PreMatching |
many thanks, worked for me too. |
Describe the bug
After upgrading 2.3.0 -> 2.6.1 my app won't start (at least in dev mode):
The client is used defined as below and configured in application.properties:
Expected behavior
Application starts as it used to.
Actual behavior
Application fails to start.
How to Reproduce?
Fetch my project at this commit: Hyperfoil/Horreum@c5184be
and change
<quarkus.version>2.3.0.Final</quarkus.version>
to<quarkus.version>2.6.1.Final</quarkus.version>
in rootpom.xml
.Output of
uname -a
orver
Linux rvansa 5.15.6-200.fc35.x86_64 #1 SMP Wed Dec 1 13:41:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.6.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
I've bisected the change and it appears to have happened 2.3.1 -> 2.4.0.
The text was updated successfully, but these errors were encountered: