我有在JBoss 6.0.1上运行的应用程序。
我使用REST架构(RESTEasy)来调用远程服务,并期望Json.I在调用GET方法时会出现异常。
以下是异常消息:
无法找到内容类型为text / plain的MessageBodyReader; charset =“utf-8”
这是我的代码:
@Override
public Room getRoomEvents(String roomID, String date) throws BackEndException {
Room room = null;
try {
ClientRequest.setDefaultExecutorClass("org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor", true);
ClientRequest request = new ClientRequest(HOSTNAME + METHOD + ROOM_ID_ARG + roomID + DATE_ARG + date);
request.accept(MediaType.APPLICATION_JSON_TYPE);
ClientResponse<Room> response = request.get(Room.class);
if (response.getResponseStatus().getStatusCode() != 200) {
throw new BackEndException(-110, Errors.ERROR_LOTUS_REQUEST, "Error lotus request");
}
room = response.getEntity();
response.releaseConnection();
} catch (Exception e) {
throw new BackEndException(-109, Errors.ERROR_LOTUS_REQUEST, "Error lotus request");
}
return room;
}
在这一行中,我得到例外: room = response.getEntity();
有谁知道什么是意思,以及如何解决这个异常?