I am using Jersey 2.13
I get MessageBoddyWriter not found exception when I try to access a resource via a url in a browser.
Exception:
MessageBodyWriter not found for media type=application/json,
type=class java.util.ArrayList, genericType=java.util.List<com.webservices.entity.Book>.
I have another method that produces "APPLICATION_XML" and that seems to work fine.
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Book {
@XmlElement
private String name;
@XmlElement
private String author;
//getters setters
}
@GET
@Path("/json")
@Produces(MediaType.APPLICATION_JSON)
public List<Book> getJsonResponse(JAXBElement<Book> book){
return new ArrayList<Book>();
}
My thought was jersey would automatically find the "JacksonJsonProvider"
, a message writer class, provided by Jackson but it doesn't.
My lib folder: