I have a similar case as the one described here: Dynamically change RESTEasy service return type
The problem I'm facing is that I'm trying to return a list of objects (annotated with @XMLRootEntity
), but I get a 500 server error code:
The server encountered an internal error (Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type: application/json) that prevented it from fulfilling this request.
Can you give some advice how to solve this issue?
I'm not sure exactly where to look.
Thanks.
You should use interface instead of using implementation of list.
Try changing return type with : java.util.List
EDIT: Try to wrap list into GenericEntity :