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.

Reactive rest client does not get registered when the interface extends another interface from dependency

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
damian-burdacommented, Aug 26, 2021

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.

0reactions
Ladicekcommented, Aug 26, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the REST Client Reactive - Quarkus
In our case the interface should be created at src/main/java/org/acme/rest/client/ExtensionsService.java and have the following content:.
Read more >
Quarkus could not find writer for content-type multipart/form ...
I solved it by making the MultiPartBody extend MultipartFormDataOutput . In your case this would be: ... import org.jboss.resteasy.plugins.
Read more >
Web on Reactive Stack - Spring
WebFlux requires Reactor as a core dependency but it is interoperable with other reactive libraries via Reactive Streams. As a general rule, a ......
Read more >
Chapter 53. MicroProfile Rest Client - JBoss.org
In particular, providers can be registered by adding the org.eclipse.microprofile.rest.client.annotation.RegisterProvider annotation to the target interface ...
Read more >
Chapter 6. Reactive JAX-RS Client API
These services might be built using different technologies (JMS, EJB, WS, ...). For simplicity we presume that the services can be consumed using...
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