com.fasterxml.jackson.databind.JsonMappingException:找不到非具体Map类型的反序列化器

时间:2018-08-31 09:16:26

标签: java ejb-3.0

我正在尝试发送发帖请求,但出现此错误:

  

com.fasterxml.jackson.databind.JsonMappingException:找不到非具体Map类型[map type;类javax.json.JsonObject,[简单类型,类java.lang.String]-> [简单类型,类javax.json.JsonValue]]

这是java代码:

@Path("")       
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response create(List<JsonObject> jsonObjects) {
    Response returnValue = JsonResponse.internalServerErrorJson();
     for (JsonObject jsonObject : jsonObjects) {
            try {
                String username = null;
                if (httpRequest != null && httpRequest.getSession() != null) {
                    username = httpRequest.getUserPrincipal().getName().toString();
                }
                Object validatorObj = profilValidator.validate(jsonObject);
                if (validatorObj instanceof ProfilJson) {
                    ((ProfilJson) validatorObj).setStoreNameCreate(username.toUpperCase());
                    Object created = profilBean.createProfil((ProfilJson) validatorObj, username);
                    if (created instanceof ProfilJson) {
                        returnValue = JsonResponse.objectToJson(created);
                    } else if (created instanceof Response) {
                        returnValue = JsonResponse.profilExistErrorJson();
                    }
                }
            } catch (Exception e) {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
                returnValue = JsonResponse.internalServerErrorJson();
            }
     }

    return returnValue;
}

这是数组对象:

  

[{“ Id”:0,“ gender”:“ F”,“ lastName”:“ toto”,“ firstName”:“ titi”,“ birthday”:“ 19911212”,   “ address”:{“ postCode”:“ 12358”,“ street1”:“”,“ street2”:“”},“电子邮件”:“ rr@rr.cc”,   “ Email”:“”,“电话”:“”}]

0 个答案:

没有答案