Describe the bug
There seems to be a weird combination between custom MP Config Source and Opentracing in Quarkus that fails to run the project in native mode.
Expected behavior
Native image should run as normal.
Actual behavior
Native image runs fails with:
ERROR: Failed to start application
java.util.ServiceConfigurationError: org.eclipse.microprofile.config.spi.ConfigSource: Provider org.jboss.resteasy.microprofile.config.ServletConfigSource could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:581)
at java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:803)
at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:721)
at java.util.ServiceLoader$3.next(ServiceLoader.java:1394)
at java.lang.Iterable.forEach(Iterable.java:74)
at io.smallrye.config.SmallRyeConfigBuilder.discoverSources(SmallRyeConfigBuilder.java:74)
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:175)
at io.quarkus.runtime.generated.Config.readConfig(Config.zig:32805)
at io.quarkus.deployment.steps.RuntimeConfigSetup.deploy(RuntimeConfigSetup.zig:38)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:94)
at io.quarkus.runtime.Application.start(Application.java:89)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:90)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
Caused by: java.lang.RuntimeException: java.lang.InstantiationException: Type `org.jboss.resteasy.microprofile.config.ServletConfigSourceImpl` can not be instantiated reflectively as it does not have a no-parameter constructor or the no-parameter constructor has not been added explicitly to the native image.
at org.jboss.resteasy.microprofile.config.BaseServletConfigSource.<init>(BaseServletConfigSource.java:26)
at org.jboss.resteasy.microprofile.config.ServletConfigSource.<init>(ServletConfigSource.java:21)
at java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:779)
... 14 more
Caused by: java.lang.InstantiationException: Type `org.jboss.resteasy.microprofile.config.ServletConfigSourceImpl` can not be instantiated reflectively as it does not have a no-parameter constructor or the no-parameter constructor has not been added explicitly to the native image.
at java.lang.Class.newInstance(DynamicHub.java:796)
at org.jboss.resteasy.microprofile.config.BaseServletConfigSource.<init>(BaseServletConfigSource.java:23)
... 17 more
May 05, 2020 12:06:49 PM io.quarkus.runtime.ApplicationLifecycleManager run
ERROR: Error running Quarkus application
java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:307)
at io.quarkus.runtime.Application.start(Application.java:89)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:90)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
Caused by: java.util.ServiceConfigurationError: org.eclipse.microprofile.config.spi.ConfigSource: Provider org.jboss.resteasy.microprofile.config.ServletConfigSource could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:581)
at java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:803)
at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:721)
at java.util.ServiceLoader$3.next(ServiceLoader.java:1394)
at java.lang.Iterable.forEach(Iterable.java:74)
at io.smallrye.config.SmallRyeConfigBuilder.discoverSources(SmallRyeConfigBuilder.java:74)
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:175)
at io.quarkus.runtime.generated.Config.readConfig(Config.zig:32805)
at io.quarkus.deployment.steps.RuntimeConfigSetup.deploy(RuntimeConfigSetup.zig:38)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:94)
... 6 more
Caused by: java.lang.RuntimeException: java.lang.InstantiationException: Type `org.jboss.resteasy.microprofile.config.ServletConfigSourceImpl` can not be instantiated reflectively as it does not have a no-parameter constructor or the no-parameter constructor has not been added explicitly to the native image.
at org.jboss.resteasy.microprofile.config.BaseServletConfigSource.<init>(BaseServletConfigSource.java:26)
at org.jboss.resteasy.microprofile.config.ServletConfigSource.<init>(ServletConfigSource.java:21)
at java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:779)
... 14 more
Caused by: java.lang.InstantiationException: Type `org.jboss.resteasy.microprofile.config.ServletConfigSourceImpl` can not be instantiated reflectively as it does not have a no-parameter constructor or the no-parameter constructor has not been added explicitly to the native image.
at java.lang.Class.newInstance(DynamicHub.java:796)
at org.jboss.resteasy.microprofile.config.BaseServletConfigSource.<init>(BaseServletConfigSource.java:23)
... 17 more
Environment (please complete the following information):
Output of uname -a or ver: 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
Output of java -version: openjdk version "11.0.7" 2020-04-14
GraalVM version (if different from Java): GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07)
Quarkus version or git rev: 1.4.1.Final
Build tool (ie. output of mvnw --version or gradlew --version): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Additional context
If we remove the dependency for quarkus-smallrye-opentracing, project runs fine in native. If we remove the registration of the custom Config Source in org.eclipse.microprofile.config.spi.ConfigSource it also works. Both together fail with the exception detailed above.
Describe the bug There seems to be a weird combination between custom MP Config Source and Opentracing in Quarkus that fails to run the project in native mode.
Expected behavior Native image should run as normal.
Actual behavior Native image runs fails with:
To Reproduce Sample project here: https://github.com/radcortez/microprofile-samples
mvn verify
services\number-api
.Configuration
Environment (please complete the following information):
uname -a
orver
: 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64java -version
: openjdk version "11.0.7" 2020-04-14mvnw --version
orgradlew --version
): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)Additional context If we remove the dependency for
quarkus-smallrye-opentracing
, project runs fine in native. If we remove the registration of the custom Config Source inorg.eclipse.microprofile.config.spi.ConfigSource
it also works. Both together fail with the exception detailed above.https://github.com/quarkusio/quarkus/issues/9086
$upstream:9086$