3.0 branch - Unrecognized field '^EncodedType' (Class org.pronoiahealth.obpgui.client.shared.vo.User), not marked as ignorable
jdestef Mar 17, 2013 10:57 AMHi,
Trying to migrate an application to 3.0 branch. Everything builds OK and deploys to jboss 7.1.4 OK. When I try to save a new entity I get an error as follows:
HTTP Status 400 -
org.codehaus
.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "^EncodedType" (Class org
.pronoiahealth.obpgui.client.shared.vo.User), not marked as ignorable
at [Source: org.apache.catalina.connector.CoyoteInputStream@6dc37afe; line: 1, column: 18] (through
reference chain: org.pronoiahealth.obpgui.client.shared.vo.User["^EncodedType"])</h1><HR size
="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>org.codehaus.jackson.map
.exc.UnrecognizedPropertyException: Unrecognized field "^EncodedType" (Class org.pronoiahealth
.obpgui.client.shared.vo.User), not marked as ignorable
at [Source: org.apache.catalina.connector.CoyoteInputStream@6dc37afe; line: 1, column: 18] (through
reference chain: org.pronoiahealth.obpgui.client.shared.vo.User["^EncodedType"])</u></p><p
><b>description</b> <u>The request sent by the client was syntactically incorrect (org.codehaus.jackson
.map.exc.UnrecognizedPropertyException: Unrecognized field "^EncodedType" (Class org.pronoiahealth
.obpgui.client.shared.vo.User), not marked as ignorable
at [Source: org.apache.catalina.connector.CoyoteInputStream@6dc37afe; line: 1, column: 18] (through
reference chain: org.pronoiahealth.obpgui.client.shared.vo.User["^EncodedType"])).
The json for to object being saved is :
{"^EncodedType":"org.pronoiahealth.obpgui.client.shared.vo.User","^ObjectID":"1","id" : null,"opVer"
: null,"firstName" : "A","lastName" : "DDDDDD","userId" : "ajdestef","resetPwd" : true,"pwdDigest"
: null,"pwdSalt" : null}
The ^EncodedType and ^ObjectID are things being added by the Errai framework?
This call is being made using thr REST framework in Errai. This looks similar to something I've seen using RestEasy before. In that case I built a custom context resolver:
@Provider
@Consumes({ "application/*+json", "text/json" })
@Produces({ "application/*+json", "text/json" })
public class JacksonConfigurator implements ContextResolver<ObjectMapper> {
.............
ObjectMapper objectMapper = getObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
and was able to override the object mappers default behavior.
The application works fine on the 2.2.1-SNAPSHOT branch.
Any help would be appreciated.
Thanks