簡體   English   中英

在寧靜的Web服務應用程序中獲取com.sun.jersey.api.MessageException

[英]Getting com.sun.jersey.api.MessageException in restful webservices application

我的代碼如下所示。

@Produces(MediaType.TEXT_XML)
public Response getEmpDetails() {

    Map<String, Employee> result = empDaoo.getEmpInfo();

    return Response.status(200).entity(result).build();
}

然后我得到這個異常:

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

誰能提供解決方案。 快速響應...

可能是用於轉換數據結構的默認提供程序無法處理Java Map嗎? 我主要使用的是包含Map和JAXB批注的自有實體。 您可以編寫自己的marschaller和unmarschaller。 希望我能給您一些提示。 周圍有大量信息,只需使用給定的流行語在Google上查找即可;)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM