Reactive rest client does not get registered when the interface extends another interface from dependency
See original GitHub issueDescribe the bug
We have a lot of API modules that are older (Java 8) but with valid JAX-RS annotations, that we are using in our Quarkus based applications to import the API and have easy REST access to our older services. It all works fine.
No we created the first reactive Quarkus app. Reactive controller needs to call an older service through REST. As usual I added the dependency to other service API, created a rest client that extends the interface from API, registered it. Then an adapter that will wrap the call in Uni. The client is not created and cannot be injected. At injection point I get following exception:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.acme.NOKRes
tClient and qualifiers [@RestClient]
- java member: org.acme.RestControllerTest#nokRestClient
- declared on CLASS bean [types=[org.acme.RestControllerTest, java.lang.Object], qualifiers=[@Default, @Any], target=org.acme.RestControllerTest]
What is interesting, it works without problems if: quarkus-rest-client-jackson is used instead of quarkus-rest-client-reactive-jackson or the methods from API interface are copied and pasted into rest client interface
I created a reproducer for this: https://github.com/damian-burda/rest-client-reactive-bug just run mvnw clean install and it will not build as the test rest client can not be injected. Do one of the steps above: change dependency or copy/paste and it will work.
Expected behavior
External API moduls with JAX-RS annotations can be also used with quarkus-rest-client-reactive-jackson as with quarkus-rest-client-jackson.
Actual behavior
The build does not work and at runtime probably also, when a rest client (quarkus-rest-client-reactive-jackson) extends interface from dependency.
How to Reproduce?
Checkout the reproducer https://github.com/damian-burda/rest-client-reactive-bug and try building it with mvnw clean install.
Output of uname -a
or ver
No response
Output of java -version
openjdk version “11.0.3” 2019-04-16 LTS
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.1.3.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.1
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Thank you both for your help. It is really so, that one bean from Lib A used this class from Lib C. I excluded this bean, as I do not need it with
quarkus.arc.exclude-types
and the problem is gone. I understand, that even if it is in the index, it will not be instantiated by Arc. Thank you very much.Ah maybe Lib A uses some type from Lib C somewhere, e.g. as method parameter / return type / field, something like that. Then an error like this can happen. Jandex itself doesn’t mind that the index info is incomplete, but a lot of parts of Quarkus implicitly assume that if a class X in the index has a method parameter / return type / field of type Y, then class Y is also present in the index.