Skip to content

Exception when using a custom registered microprofile converter #8920

@debae

Description

@debae

Describe the bug
It is possible to have configuration in application.properties / application.yaml that you don't want to convert to a String but a object of some type. Via org.eclipse.microprofile.config.spi.Converter it is possible to register such a Converter.

If we now run the test annotated with @QuarkusTest we get an exception.

Expected behavior
No exception should occur and the properties should be correctly converted to the required object.

Actual behavior
The following exception is thrown :

java.util.ServiceConfigurationError: org.eclipse.microprofile.config.spi.Converter: com.ennovativesolutions.converter.LocationConverter not a subtype
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1236)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
	at java.base/java.lang.Iterable.forEach(Iterable.java:74)
	at io.smallrye.config.SmallRyeConfigBuilder.discoverConverters(SmallRyeConfigBuilder.java:87)
	at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:184)
	at io.quarkus.runtime.configuration.QuarkusConfigFactory.getConfigFor(QuarkusConfigFactory.java:33)
	at io.smallrye.config.SmallRyeConfigProviderResolver.getConfig(SmallRyeConfigProviderResolver.java:86)
	at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:168)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:245)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:130)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:52)
	at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:131)
	at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:269)
	at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:292)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:359)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:359)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:189)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)

To Reproduce
Steps to reproduce the behavior:

  1. Run the the LocationServiceTest

Configuration

quarkus:
  log:
    level: INFO
    console:
      enable: true
      format: {"timestamp": "%d{yyyy-MM-dd'T'HH:mm:ss.SSS}", "type":"LogMessage", "level": "%p", "loggerName": "%C", "message": "%s", "appName":"location", "componentName":"location-lambda", "stackTrace":"%e" }
  lambda:
    handler: LocationLambda
  ssl:
    native: true

locations:
  - prefix: 27
    name: LocationName

Environment (please complete the following information):

  • Output of uname -a or ver: Darwin APRXJGH6D5D5F9 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64
  • Output of java -version: OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
  • GraalVM version (if different from Java): N/A
  • Quarkus version or git rev: 1.4.1.Final
  • Build tool (ie. output of mvnw --version or gradlew --version): Gradle(w) 6.0.1

Additional context
In the previous version of Quarkus 1.3.2.Final the converter was not found when running the test, so I upgraded to 1.4.1.Final and bumped into this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions