karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neehal <nsha...@actiance.com>
Subject JacksonJaxbJsonProvider doesn't work properly after upgrading CXF to 3.x
Date Thu, 03 May 2018 09:39:14 GMT
I have karaf v4.1.5 and have installed CXF v3.2.2. What I notice is that, my
jackson serialization only works if I remove any XML JAXB annotations from
the response class. 
I have my JacksonJaxbJsonProvider configured in the blueprint as a provider.

<bean id="jsonProvider" class="com.xyz.cxf.CustomJacksonJaxbJsonProvider">
<jaxrs:server id="xyz" address="/cxf">
			<ref component-id="applicationWebService" />
			<ref component-id="jsonProvider" />  

My 'CustomJacksonJaxbJsonProvider' extends 'JacksonJaxbJsonProvider', and I
have configured the following:

ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

The above take effect only if do not have any JAXB annotations(e.g.
@XmlRootElement) in the response class. 
My response has a map that shows like,
{ entry: { key: "xyz", value: "abc"}}, instead of ,
{ "xyz" : "abc" } 

This was not a problem with my earlier CXF v2.7.13 on Karaf. Has anyone else
faced a similar problem?


Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

View raw message