我的IDE给了我错误Unhandled Exception com.fasterxml.jackson.databind.JsonMappingException的mapper.readValue行
ObjectMapper mapper = new ObjectMapper();
try {
if (response.isEmpty()) {
//Http 204 (No Content) returned from MCC
//We should handle this differently
user = new User();
} else {
user = mapper.readValue(response, User.class);
}
} catch (IOException ioe) {
logger.log(Level.SEVERE, ioe.getLocalizedMessage());
}
return user;
Run Code Online (Sandbox Code Playgroud)
我试过捕捉JsonMappingException它,但它没有让错误消失.有什么想法吗?
小智 6
当我只添加jackson-mapper-asljar 时,我遇到了这个问题.当我添加jackson-core-asljar时它起作用了.
杰克逊2也是如此.如果您只包括,则会发生此错误jackson-databind.你也需要包括在内jackson-core.
| 归档时间: |
|
| 查看次数: |
5704 次 |
| 最近记录: |