[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [osgi-users] JAX-RS Exception mapper issue
|
Hi Alain,
if I am not wrong, you return the Exception in the resource
instead of thowing it. When you return something, it first runs
through the message body writer first before the execption mapper
is called. If this entity cannot be handles from a message body
writer, you get exactly this error.
Whereas the exception mapper is called for thown exceptions.
I hope this helps.
Regards,
Mark
Am 19.01.23 um 15:17 schrieb Alain
Picard:
Hi,
I have a JAX-RS service with an ExceptionMapper which
returns this in case of error:
No message body writer
has been found for class
com.castortech.iris.ba.ecore.rest.rest.RestException,
ContentType: application/json
I have an ExceptionMapper that I can confirm is activated,
and tried with and without the App select below:
@Component(
property = {
JAX_RS_EXTENSION +
"=true",
ApiConstants.REST_API_APP_SELECT
}
)
public class
DefaultExceptionMapper implements
ExceptionMapper<RestException> {
And in the service
itself:
return Response
.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity(new RestException(e))
.build();
Changing the service to return the exception message as
text/plain works, but it is not really what I would like to do
here.
Cheers,
Alain
_______________________________________________
osgi-users mailing list
osgi-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/osgi-users
--
Mark Hoffmann
M.A. Dipl.-Betriebswirt (FH)
Geschäftsführer
Tel: +49 3641 384 910 0
Mobil: +49 175 701 2201
E-Mail: m.hoffmann@xxxxxxxxxxxxxxxxxx
Web: www.datainmotion.de
Data In Motion Consulting GmbH
Kahlaische Straße 4
07745 Jena
Geschäftsführer
Mark Hoffmann
Jürgen Albert
Jena HRB 513025
Steuernummer 162/107/05779
USt-Id DE310002614