Search code examples
jax-rsresteasybean-validation

How can I get rid of ResteasyViolationExceptionMapper?


I'm using JBoss EAP which contains RESTeasy as JAX-RS implementation. I want to have an ExceptionMapper<Exception> where I can map all exceptions coming from our REST services in one central place.

However, when validating the method parameters with Bean Validation, my ExceptionMapper<Exception> is ignored, since ResteasyViolationExceptionMapper kicks in.

Other than creating another ExceptionMapper<ConstraintViolationException> and duplicating my code... is there any way to suppress ResteasyViolationExceptionMapper?


Solution

  • Well, after a lot of searching I found a possibility to disable that ExceptionMapper in web.xml

    <web-app>
    
      <context-param>
        <param-name>resteasy.disable.providers</param-name>
        <param-value>org.jboss.resteasy.api.validation.ResteasyViolationExceptionMapper</param-value>
      </context-param>
    
    </web-app>