question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ClassNotFoundException with quarkus.hibernate-search.elasticsearch.analysis.configurer

See original GitHub issue

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:

  1. Create a new project with the Hibernate Search + Elasticsearch extension.
  2. Create a new class (org.acme.AnalysisConfigurer) which implements ElasticsearchAnalysisConfigurer.
  3. 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 -a or ver: 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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
yrodierecommented, Nov 8, 2019

@kenfinnigan Fair enough, but we are not talking about extraction of string values here, we are talking about extraction of Class values.

The problem is that I have a @ConfigItem of type Class in the Hibernate Search extension, and Quarkus doesn’t trim the string before it tries to convert the property value to a Class.

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.Converter implementations?

1reaction
jaikirancommented, Nov 8, 2019

Hello @lgarin, @yrodiere,

Caused by: java.lang.ClassNotFoundException: org.acme.AnalysisConfigurer

Notice that the ClassNotFoundException message has a trailing whitespace after the class name, so that’s a sign that the property value of quarkus.hibernate-search.elasticsearch.analysis.configurer is having a trailing whitespace.

Perhaps this is relevant to the recent change done in trimming property values https://github.com/quarkusio/quarkus/pull/5050?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hibernate Search guide - Quarkus
Disable Elasticsearch version checks on startup by setting the configuration property quarkus.hibernate-search-orm.elasticsearch.version-check.enabled to false ...
Read more >
Build Items - Quarkus
A build item that allows extension to configure the native-image compiler to effectively ignore certain configuration files in specific jars. The property ...
Read more >
Connecting to an Elasticsearch cluster - Quarkus
configure the Elasticsearch client for a cluster of two nodes quarkus.elasticsearch.hosts ... Quarkus supports Hibernate Search with Elasticsearch via the ...
Read more >
New extension: Hibernate Search + Elasticsearch - Quarkus
I soon started to contribute to it and…​ here I am. With an additional dependency and some configuration, you end up being able...
Read more >
Hibernate Search 6.1.7.Final: Reference Documentation
Hibernate Search, full text search for your entities - Reference Documentation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found