users@jersey.java.net

[Jersey] Customizing JsonParseExceptionMapper not working

From: Pritam Moodbidri <pritam_at_yahoo-inc.com>
Date: Thu, 18 Jun 2015 05:43:38 +0000 (UTC)

Hi,
I am using Jersey 2.18 and Jackson 2.5.3. I am trying to customize, JsonParseExceptionMapper, by the technique documented everywhere. I am using the Provider annotation, and also extending javax.ws.rs.ext.ExceptionMapper, and specifying which exception to map.
What I see is that, there is a race condition that happens. Sometimes, my exception mapper is not used, and the JsonParseExcpetionProvided by Jackson, gets used, and sometimes its the other way around, which differs each time the application gets loaded. I feel this is related to the auto discover feature. Is there any way to make sure my JsonParseExceptionMapper always gets used, without actually having to register that class, for each application.
Thanks
- Pritam