quarkus: ClassNotFoundException with quarkus.hibernate-search.elasticsearch.analysis.configurer
Describe the bug
Starting with Quarkus 0.28, the Quarkus augmentation phase fails with a ClassNotFoundException as soon as a value is configured using the property quarkus.hibernate-search.elasticsearch.analysis.configurer.
Expected behavior With Quarkus version 0.27, the same class can be loaded without issue.
Actual behavior Quarkus statup fails with the following stack trace:
20:28:50,919 INFO [io.qua.dep.QuarkusAugmentor] Beginning quarkus augmentation
20:28:51,073 ERROR [io.qua.dev.DevModeMain] Failed to start Quarkus: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: org.acme.AnalysisConfigurer
at io.smallrye.config.Converters.lambda$static$7c03a47f$1(Converters.java:90)
at io.smallrye.config.Converters$BuiltInConverter.convert(Converters.java:477)
at io.smallrye.config.SmallRyeConfig.getOptionalValue(SmallRyeConfig.java:139)
at io.smallrye.config.SmallRyeConfig.getOptionalValue(SmallRyeConfig.java:131)
at io.quarkus.runtime.configuration.ConfigUtils.getOptionalValue(ConfigUtils.java:92)
at io.quarkus.deployment.configuration.OptionalObjectConfigType.acceptConfigurationValueIntoGroup(OptionalObjectConfigType.java:81)
at io.quarkus.deployment.configuration.GroupConfigType.acceptConfigurationValueIntoLeaf(GroupConfigType.java:238)
at io.quarkus.deployment.configuration.OptionalObjectConfigType.acceptConfigurationValue(OptionalObjectConfigType.java:36)
at io.quarkus.deployment.configuration.ConfigDefinition.loadConfiguration(ConfigDefinition.java:501)
at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:229)
at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:144)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:88)
at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:111)
at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:177)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:95)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66)
Caused by: java.lang.ClassNotFoundException: org.acme.AnalysisConfigurer
at io.quarkus.runner.RuntimeClassLoader.findClass(RuntimeClassLoader.java:229)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at io.quarkus.runner.RuntimeClassLoader.loadClass(RuntimeClassLoader.java:172)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:415)
at io.smallrye.config.Converters.lambda$static$7c03a47f$1(Converters.java:88)
... 15 more
To Reproduce Steps to reproduce the behavior:
- Create a new project with the
Hibernate Search + Elasticsearchextension. - Create a new class (
org.acme.AnalysisConfigurer) which implementsElasticsearchAnalysisConfigurer. - Configure the application according to the next section.
Configuration
quarkus.hibernate-search.elasticsearch.version=7.4
quarkus.hibernate-search.elasticsearch.analysis.configurer=org.acme.AnalysisConfigurer
Environment (please complete the following information):
- Output of
uname -aorver:Microsoft Windows [Version 10.0.18362.418] - Output of
java -version:Java(TM) SE Runtime Environment (build 1.8.0_144-b01) - Quarkus version or git rev:
1.0.0.CR1
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (21 by maintainers)
@kenfinnigan Fair enough, but we are not talking about extraction of string values here, we are talking about extraction of
Classvalues.The problem is that I have a
@ConfigItemof typeClassin the Hibernate Search extension, and Quarkus doesn’t trim the string before it tries to convert the property value to aClass.Surely the spec doesn’t mandate that we keep the trailing spaces and fail miserably when interpreting a property value as a
Class?I believe this has something to do with the built-in
org.eclipse.microprofile.config.spi.Converterimplementations?Hello @lgarin, @yrodiere,
Notice that the
ClassNotFoundExceptionmessage has a trailing whitespace after the class name, so that’s a sign that the property value ofquarkus.hibernate-search.elasticsearch.analysis.configureris having a trailing whitespace.Perhaps this is relevant to the recent change done in trimming property values https://github.com/quarkusio/quarkus/pull/5050?