Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resteasy-reactive : JPA TenantResolver fails with Normal scoped producer method may not return null: io.quarkus.vertx.http.runtime.CurrentVertxRequest #16934

Closed
laurentperez opened this issue May 1, 2021 · 1 comment · Fixed by #16936
Assignees
Labels
area/rest kind/bug Something isn't working
Milestone

Comments

@laurentperez
Copy link
Contributor

laurentperez commented May 1, 2021

Describe the bug

Following https://quarkus.io/guides/hibernate-orm#writing-the-application

  • Implement a @RequestScoped TenantResolver, inject Vertx routingContext to get access to the request context (path, parameters)
    @Inject
    lateinit var context: RoutingContext
  • Add @Blocking to the controller using JPA to let the method run on worker thread and not slow down the event loop
  • the controller uses @GET and @Path, not reactive routes, see below
  • query the controller

Expected behavior

Vertx routing context to be accessible when we use resteasy-reactive

I guess it's related to #13262

I see that https://quarkus.io/guides/reactive-routes exists and has a RoutingExchange, but I don't see how to "see" it within the TenantResolver

If this is a bug (?), maybe the documentation should be updated too to show example of context.

Actual behavior

throws on context.getRequest()


2021-05-01 20:53:11.353 CEST+0200 (executor-thread-1 #80) (GradleWorkerMain pid:411885) org.jboss.resteasy.reactive.server.core.ExceptionMapping ERROR Request failed : javax.enterprise.inject.IllegalProductException: Normal scoped producer method may not return null: io.quarkus.vertx.http.runtime.CurrentVertxRequest.getCurrent()
	at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_Bean.create(CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_Bean.zig:178)
	at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_Bean.create(CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_Bean.zig:197)
	at io.quarkus.arc.impl.RequestContext.getIfActive(RequestContext.java:68)
	at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:33)
	at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_ClientProxy.arc$delegate(CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_ClientProxy.zig:60)
	at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_ClientProxy.request(CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_ClientProxy.zig:302)
	at com.xxxxxxxxxxxxxxx.resolveTenantId(JPATenantResolver.kt:19)
	at com.xxxxx.JPATenantResolver_ClientProxy.resolveTenantId(JPATenantResolver_ClientProxy.zig:238)


To Reproduce

see above

Environment (please complete the following information):

jdk11 qk 1.13.3

@laurentperez laurentperez added the kind/bug Something isn't working label May 1, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented May 1, 2021

/cc @FroMage, @geoand, @stuartwdouglas

@quarkus-bot quarkus-bot bot added the area/rest label May 1, 2021
@geoand geoand self-assigned this May 2, 2021
geoand added a commit to geoand/quarkus that referenced this issue May 2, 2021
This is done in order to stay in line with what Quarkus allows
when using RESTEasy Classic

Fixes: quarkusio#16934
geoand added a commit that referenced this issue May 3, 2021
Allow injection of RoutingContext in RESTEasy Reactive
@quarkus-bot quarkus-bot bot added this to the 2.0 - main milestone May 3, 2021
@gsmet gsmet modified the milestones: 2.0.0.Alpha2, 1.13.4.Final May 10, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue May 10, 2021
This is done in order to stay in line with what Quarkus allows
when using RESTEasy Classic

Fixes: quarkusio#16934
(cherry picked from commit 46a41de)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants