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 exception mapper issues #15763

Closed
FroMage opened this issue Mar 16, 2021 · 7 comments · Fixed by #15779
Closed

RESTEasy Reactive exception mapper issues #15763

FroMage opened this issue Mar 16, 2021 · 7 comments · Fixed by #15779
Assignees
Labels
area/rest kind/bug Something isn't working
Milestone

Comments

@FroMage
Copy link
Member

FroMage commented Mar 16, 2021

This one happens only in DEV mode. Start with this endpoint:

@Path("/")
public class GreetingResource {

    @Path("fruit/{id}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Uni<Object> fruit(@PathParam("id") Long id){
        throw new NotFoundException();
    }
    
//    @ServerExceptionMapper(NotFoundException.class)
//    public Response handleNotFound() {
//        System.err.println("We're in there");
//        return Response.status(Response.Status.NOT_FOUND)
//                .entity(new JsonObject()
//                        .put("type", "https://example.com/probs/cant-touch-this")
//                        .put("title", "we could not find it :("))
//                .type(MediaType.APPLICATION_JSON)
//                .build();
//    }
}

Now trigger the 404 with GET /fruit/123, you get the DEV Mode 404 red page.

Now uncomment the exception mapper and reload the page, you get:

Error handling 56fcd1fd-68f3-4922-926f-a263fa4ab22c-2, java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.acme1.GreetingResource$GeneratedExceptionHandlerFor$NotFoundException$OfMethod$handleNotFound

This looks very similar to #15748, but only for DEV mode. Perhaps it's different?

Now, a more annoying thing is that if I change the endpoint method to:

    @Path("fruit/{id}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Uni<Object> fruit(@PathParam("id") Long id){
        return Uni.createFrom().failure(() -> new NotFoundException());
    }

It behaves differently and doesn't even try to run my exception mapper, when it should be identical to the previous endpoint.

@FroMage FroMage added kind/bug Something isn't working area/rest labels Mar 16, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 16, 2021

/cc @geoand, @stuartwdouglas

@geoand
Copy link
Contributor

geoand commented Mar 16, 2021

#15767 takes care of the second problem. The first one I can't reproduce.

@geoand geoand self-assigned this Mar 16, 2021
@geoand
Copy link
Contributor

geoand commented Mar 16, 2021

The first problem is due to Vertx event-loop threads hanging on to the original Quarkus ClassLoader.
@stuartwdouglas haven't we fixed something similar before somewhere?

@geoand
Copy link
Contributor

geoand commented Mar 16, 2021

Actually I am pretty sure I know what the problem is but I need to investigate more

@geoand
Copy link
Contributor

geoand commented Mar 16, 2021

#15779 should fix the first case

geoand added a commit to geoand/quarkus that referenced this issue Mar 16, 2021
geoand added a commit that referenced this issue Mar 16, 2021
Make per class @ServerExceptionMapper work with Mutiny response types
geoand added a commit to geoand/quarkus that referenced this issue Mar 17, 2021
geoand added a commit that referenced this issue Mar 17, 2021
Make sure the proper TCCL isn't lost in dev mode when static resource exist
@quarkus-bot quarkus-bot bot added this to the 1.13 - main milestone Mar 17, 2021
@FroMage
Copy link
Member Author

FroMage commented Mar 17, 2021

Thanks!

@geoand
Copy link
Contributor

geoand commented Mar 17, 2021

YW!

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.

2 participants