quarkus: Error injecting RestClient after upgrade to Quarkus 1.13.2
Describe the bug
Starting with Quarkus 1.12.2 (not seen in 1.12.1, seen in 1.13.2 and 1.13.3) we see the following error for some time after application startup:
SLF4J: Failed toString() invocation on an object of type [com.sample.clients.SampleClient_ClientProxy]
Reported exception:
java.lang.RuntimeException: Error injecting com.sample.clients.sample.ISampleRestClient com.sample.clients.SampleClient.sampleRestClient
at com.sample.clients.SampleClient_Bean.create(sampleClient_Bean.zig:338)
at com.sample.clients.SampleClient_Bean.create(sampleClient_Bean.zig:447)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96)
at io.quarkus.arc.impl.AbstractSharedContext.access$000(AbstractSharedContext.java:14)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
at com.sample.clients.SampleClient_ClientProxy.arc$delegate(sampleClient_ClientProxy.zig:67)
at com.sample.clients.SampleClient_ClientProxy.toString(sampleClient_ClientProxy.zig:153)
at org.slf4j.helpers.MessageFormatter.safeObjectAppend(MessageFormatter.java:277)
at org.slf4j.helpers.MessageFormatter.deeplyAppendParameter(MessageFormatter.java:249)
at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:211)
at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:161)
at ch.qos.logback.classic.spi.LoggingEvent.getFormattedMessage(LoggingEvent.java:293)
at ch.qos.logback.classic.spi.LoggingEvent.prepareForDeferredProcessing(LoggingEvent.java:206)
at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:223)
at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:102)
at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.error(Logger.java:534)
at com.sample.services.SampleService.sampleMethod(SampleService.java:127)
at com.sample.services.SampleService.lambda$scheduledActionTask$2(SampleService.java:99)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1746)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.IllegalArgumentException: Unable to determine the proper baseUrl/baseUri. Consider registering using @RegisterRestClient(baseUri="someuri"), @RegisterRestClient(configKey="orkey"), or by adding 'com.sample.clients.sample.ICallRestClient/mp-rest/url' or 'com.sample.clients.sample.ICallRestClient/mp-rest/uri' to your Quarkus configuration
ing 'com.sample.clients.sample.ICallRestClient/mp-rest/url' or 'com.sample.clients.sample.ICallRestClient/mp-rest/uri' to your Quarkus configuration
Expected behavior
Rest clients should be injected properly.
Actual behavior
Looks like clients settings from application.properties are not available for some time.
To Reproduce
Wait until periodic task runs and tries to use previously saved reference to instance of the class using rest client.
Configuration
# Add your application.properties here, if applicable.
com.sample.clients.sample.ISampleRestClient/mp-rest/url=${TEST_URL}
com.sample.clients.sample.ISampleRestClient/mp-rest/connectTimeout=15000
com.sample.clients.sample.ISampleRestClient/mp-rest/readTimeout=15000
Environment (please complete the following information):
The attached archive contains a sample application reflecting the logic and structure of the failing part of actual application - the simplest one with which issue could be reproduced (in the actual application). However, for some reason, with the sample app this issue could not be reproduced. getting-started-injection.tar.gz
Output of uname -a
or ver
Distroless java used: gcr.io/distroless/java-debian10:11
Quarkus version or git rev
1.13.2
Build tool (ie. output of mvnw --version
or gradlew --version
)
/usr/bin/mvn -version Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /usr/share/apache-maven-3.8.1 Java version: 11.0.11, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: “linux”, version: “4.15.0-1113-azure”, arch: “amd64”, family: “unix”
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (11 by maintainers)
@geoand the problem with this issue is that I can easily reproduce it with our application, which is much more complex than the sample I provided but for some reason I cannot reproduce it with the sample code. The latter mimics the failing part of the application. I am currently trying to strip the actual application down to be able to provide a better sample.