Hi All, I am using Karaf 3.0.0 to deploy my camel blueprint application which creates a rest route.
I have exposed a rest service which accepts a org.codehaus.jettison.json.JSONObject in its paramater. @POST @Consumes(MediaType.APPLICATION_JSON) public void sayPlainTextHello(JSONObject json) { The rest server has been configured as <cxf:rsServer id="rsServer" address="/camel-example/rest" serviceClass="com.gemato.rest.CustomerServiceResource" loggingFeatureEnabled="true" > <cxf:providers> <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/> </cxf:providers> </cxf:rsServer> When I POST the request, with JSON as {"name":"sayhello"}, I get unsupported media type exception as response and below exception in the logs. at java.lang.Thread.run(Thread.java:662) Caused by: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "name" (Class org.codehaus.jettison.json.JSONObject), not marked as ignorable at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@b5e58f; line: 1, column: 10] (through reference chain: org.codehaus.jettison.json.JSONObject["name"]) at org.codehaus.jackson.map.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:53) at org.codehaus.jackson.map.deser.StdDeserializationContext.unknownFieldException(StdDeserializationContext.java:267) at org.codehaus.jackson.map.deser.std.StdDeserializer.reportUnknownProperty(StdDeserializer.java:673) at org.codehaus.jackson.map.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:659) at org.codehaus.jackson.map.deser.BeanDeserializer.handleUnknownProperty(BeanDeserializer.java:1365) at org.codehaus.jackson.map.deser.BeanDeserializer._handleUnknown(BeanDeserializer.java:725) When I use a custom entity(which has "name" variable ) as method parameter, it works. I guess it is trying to construct the JSONObject and it does not have a variable "name" and hence it fails. I found similar issue online which says that Jersey won't automatically unwrap the JSONstring to JSONObject on its own but I tried with a sample jersey example and deployed it in tomcat, there I was successfully able to receive JSONObject in method paramter. http://stackoverflow.com/questions/17631017/jersey-jackson-arbitrary-json Is it possible to do this in karaf/camel as well? If no, is there is any workaround for this. We do not want to create a custom entity for this as it will limit the JSON request. Regards, Aryan -- View this message in context: http://camel.465427.n5.nabble.com/org-codehaus-jackson-map-exc-UnrecognizedPropertyException-Unrecognized-field-name-Class-org-codehaue-tp5755518.html Sent from the Camel - Users mailing list archive at Nabble.com.