我的RESTful Web服务的工作,我已经写了一个小的RESTful服务,它返回一个JSON数据,这里是我的代码:问题的RESTful Web服务
@Path("/test")
公共类TestService的{
@GET
@Produces(MediaType.APPLICATION_JSON)
public String sayHello() {
return "<h6> Hello, Welcome to the world of REST (Plain Text) </h6>";
}
@GET
@Path("dbdetails")
@Produces(MediaType.APPLICATION_JSON)
public Map<String, List> getDBDetails() {
System.out.println("ramesh kumar ");
List<ProductCategories> list = new ArrayList<ProductCategories>();
HashMap<String,List> map = new HashMap<String,List>();
ProductCategories cat = new ProductCategories();
cat.setId(1);
cat.setImage("Image21");
cat.setName("Electronics");
cat.setRowid(111);
cat.setType("CatType");
list.add(cat);
map.put("Ramesh",list);
System.out.println("ramesh kumar ");
return map;
}
但我得到的错误:
重度:消息正文作家Java类型,类java.util.HashMap中,和MIME媒体类型,应用/ JSO N,没有发现 2011年3月3日下午三时32分41秒com.sun.jersey.server.impl.application.WebApplicationImpl onException的 重度:内部服务器错误 javax.ws.rs.WebApplicationException
有任何想法吗?
你需要想出一个比“平静的web服务问题”更吸引人的标题。 – skaffman 2011-03-03 10:13:26