Jersey/Jackson Exception problem with ExceptionMapper

前端 未结 5 1246
野趣味
野趣味 2021-02-04 05:07

I\'m using Jersey to provide a java REST service to the outside world. I offer some functions that take JSON and I use the Jackson framework in combination with jersey to conver

5条回答
  •  失恋的感觉
    2021-02-04 05:56

    Of course Jackson exception is thrown before: the Jackson provider is called in order to create an object you are expecting in your method. However, with ExceptionMapper you should be able to map not only your exceptions, but also the providers exception.

    Are you sure your provider is registered? Does it being called if your throw exception from your method and not from provider?

    If the answer to the previous question is "yes", try to implement ExceptionMapper for a concrete exception instead of Throwable.

提交回复
热议问题