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.

ExceptionMapper not working with @Provider annotaion

See original GitHub issue

Environment Details

  • Helidon Version: 2.0.0-M3
  • Helidon MP
  • JDK version: 11
  • OS: macOS Catalina

Problem Description

I created the following ExceptionMapper using the @Provider annotation:

@Provider
public class ConstraintViolationExceptionMapper implements ExceptionMapper<ConstraintViolationException> {

    @Override
    public Response toResponse(ConstraintViolationException e) {
        
        return Response.status(Response.Status.BAD_REQUEST).build();
    }
    
}

But for some reason it’s not recognized by the application. I could make it work when I manually registered it in my Application class. Is this the intended behavior?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
spericascommented, Jul 6, 2020

Closing as cannot reproduce. Please re-open if necessary.

0reactions
spericascommented, Jan 7, 2022

@antonio-petricca Please re-open with a reproducer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

toResponse in jersey ExceptionMapper does not get invoked
When I moved to jersey v > 2.5, it stopped working. I resolved this very issue by putting @Singleton annotation instead of @Component...
Read more >
ExceptionMapper not working with @Provider annotaion #1857
Problem Description. I created the following ExceptionMapper using the @Provider annotation: @Provider public class ...
Read more >
Java Configuration with Jersey @Provider ExceptionMapper ...
Declaring a (Jersey, not javax.servlet) filter and annotating my resource with it worked perfectly! RestErrorFilter.java import com.sun.jersey.
Read more >
Defining exception mappers for resource exceptions and errors
ExceptionMapper class and annotate the class with the javax.ws.rs.ext.Provider annotation. This step assumes that your JAX-RS resource can throw ...
Read more >
How to handle Exceptions in JAX-RS applications
How does the process work? Firstly, the Web container searches for an Exception Mapper. If found, the Exception Mapper will handle the error ......
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