My code looks like this.
@Produces(MediaType.TEXT_XML)
public Response getEmpDetails() {
Map<String, Employee> result = empDaoo.getEmpInfo();
return Response.status(200).entity(result).build();
}
Then I am getting this exception:
SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class java.util.HashMap, and Java type class java.util.HashMap, and MIME media type text/xml was not found
Can any one provide the solution plz.
Quick response plz…
Could it be that the default provider for transforming data structures cannot handle Java Map? What I use mostly is an own entity containing the Map in combination with JAXB annotation. You could write your own marschaller and unmarschaller. Hope I could give you some hints to look for. There are massive information around, just look on Google with the given buzzwords 😉