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
Since Quarkus v3.18.0 and above, custom converters for primitive type arrays make Quarkus fail at startup with a ClassNotFoundException exception ([B class not found, so byte[] class).
Here's a simple converter to read a String value as a byte array:
In Quarkus v3.17.8, Quarkus is starting correctly and the converter works. Since Quarkus v3.18.0 (still in latest 3.18.2), Quarkus is failing when starting up.
Expected behavior
Quarkus should start correctly.
Actual behavior
Quarkus startup fails with ClassNotFoundException.
ERROR [io.qua.run.Quarkus] (Quarkus Main Thread) Error running Quarkus: java.lang.ExceptionInInitializerError
at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
at java.base/jdk.internal.misc.Unsafe.allocateInstance(Native Method)
at java.base/java.lang.invoke.DirectMethodHandle.allocateInstance(DirectMethodHandle.java:501)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:76)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:48)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:137)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:116)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: [B
at io.quarkus.runtime.configuration.AbstractConfigBuilder.withConverter(AbstractConfigBuilder.java:30)
at io.quarkus.runtime.generated.StaticInitConfigCustomizer.configBuilder(Unknown Source)
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:770)
at io.quarkus.runtime.generated.Config.<clinit>(Unknown Source)
... 11 more
Caused by: java.lang.ClassNotFoundException: [B
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:526)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:569)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:517)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:569)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:517)
at io.quarkus.runtime.configuration.AbstractConfigBuilder.withConverter(AbstractConfigBuilder.java:28)
... 14 more
jdussouillez
changed the title
Configuration custom converters fails on primitive type arrays since Quarkus v3.18
Configuration custom converters fail on primitive type arrays since Quarkus v3.18
Feb 10, 2025
We essentially use Class.forName to load the class instead of the
ClassLoader directly, as the former knows how to deal with arrays
Fixes: quarkusio#46170
We essentially use Class.forName to load the class instead of the
ClassLoader directly, as the former knows how to deal with arrays
Fixes: quarkusio#46170
We essentially use Class.forName to load the class instead of the
ClassLoader directly, as the former knows how to deal with arrays
Fixes: quarkusio#46170
(cherry picked from commit 909bf16)
Describe the bug
Since Quarkus v3.18.0 and above, custom converters for primitive type arrays make Quarkus fail at startup with a
ClassNotFoundException
exception ([B
class not found, sobyte[]
class).Here's a simple converter to read a String value as a byte array:
In Quarkus v3.17.8, Quarkus is starting correctly and the converter works. Since Quarkus v3.18.0 (still in latest 3.18.2), Quarkus is failing when starting up.
Expected behavior
Quarkus should start correctly.
Actual behavior
Quarkus startup fails with
ClassNotFoundException
.How to Reproduce?
Reproducer: https://github.com/jdussouillez/quarkus-custom-converter
./mvnw quarkus:dev
=> Failure./mvnw quarkus:dev -Dquarkus.platform.version=3.17.8
=> Works fineOutput of
uname -a
orver
No response
Output of
java -version
openjdk version "21.0.5" 2024-10-15 LTS
Quarkus version or git rev
v3.18.0 ... v3.18.2
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.9
Additional information
I guess it's a regression because it's not mention in 3.18 migration guide. And it's not mentionned in Microprofile config documentation.
A workaround for v3.18 is to use a record to wrap the
byte[]
field.The text was updated successfully, but these errors were encountered: