You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Valiktor 0.12.0, I added some custom constraints including a custom resource bundle for i18n. Therefore, I implemented a custom interface extending the Constraint interface and overrode the messageBundle property as a base interface for my constraints.
My application is running on Quarkus 1.13 and the validation messages from the default and the custom resource bundle are loaded when running the application from the JAR file or in tests, using ConstraintViolation.toMessage(). However, Quarkus offers a development mode (see https://quarkus.io/guides/getting-started#development-mode) which provides things like hot deployment and against which you usually work during development. In dev mode the lookup of the resource bundle does not work, though it is correctly located in the classpath.
The root cause seems to be a class loader issue since I can successfully look the resource bundle up in my code, but it doesn't work from the classes in the Valiktor lib.
I can imagine that this problem could also appear in other contexts with special class loading behaviour like application servers or OSGi.
Solution
I found the following Issue in the Quarkus Github Repo (quarkusio/quarkus#8103) where they propose to always look up resource bundles passing the context class loader:
Could Valiktor be changed so that resource bundles are always looked up like described or maybe add this as an alternative when the existing mechanism cannot find a bundle?
Alternatives
As a workaround, we are using Valiktor now without i18n, which is not a long term solution.
The text was updated successfully, but these errors were encountered:
Problem
Using Valiktor 0.12.0, I added some custom constraints including a custom resource bundle for i18n. Therefore, I implemented a custom interface extending the Constraint interface and overrode the messageBundle property as a base interface for my constraints.
My application is running on Quarkus 1.13 and the validation messages from the default and the custom resource bundle are loaded when running the application from the JAR file or in tests, using
ConstraintViolation.toMessage()
. However, Quarkus offers a development mode (see https://quarkus.io/guides/getting-started#development-mode) which provides things like hot deployment and against which you usually work during development. In dev mode the lookup of the resource bundle does not work, though it is correctly located in the classpath.The root cause seems to be a class loader issue since I can successfully look the resource bundle up in my code, but it doesn't work from the classes in the Valiktor lib.
I can imagine that this problem could also appear in other contexts with special class loading behaviour like application servers or OSGi.
Solution
I found the following Issue in the Quarkus Github Repo (quarkusio/quarkus#8103) where they propose to always look up resource bundles passing the context class loader:
Could Valiktor be changed so that resource bundles are always looked up like described or maybe add this as an alternative when the existing mechanism cannot find a bundle?
Alternatives
As a workaround, we are using Valiktor now without i18n, which is not a long term solution.
The text was updated successfully, but these errors were encountered: