Hi
On 17/06/13 11:19, Julio Carlos Barrera Juez wrote:
Hi!

I'm trying to achieve the same configuration than you, Neil. I'm not using
Spring, but Blueprint. Moreover, I have a multi-bundle configuration. I
have DOSGi that offers REST API of my services published in the OSGi
Service Registry. I have one of these services that needs to be serialized
using JSON instead of XML. Then, I want to use Jackson 2.2.x (FasterXML
Maven group ID, not Codehaus) as JSON provider, but I don't know how to
tell DOSGi using my own JSON provider.

I have tried using DOSGi property "org.apache.cxf.rs.provider" with value
"com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider", but I get:

"No message body reader has been found for request class ModelObjectA,
ContentType : application/json."

and "415 Unsupported Media Type" in client.

It may be related to the fact CXF 2.7.2 does not correctly recognize Jackson 2.2.x - try CXF 2.7.6-SNAPSHOT - or use earlier Jackson version for now

Cheers, Sergey

I have tried to declare my JSON provider as a bean in my blueprint, but I
does not work. The problem is that "DOSGi is not declared in any place", it
is an OSGi feature declared as a bundle in my OSGi container. Then, I have
no way to configure it.

What can I do?

Thank you very much.


On 14 June 2013 15:19, Julio Carlos Barrera Juez <
[email protected]> wrote:

Thank you very much, I will try it on Monday ;-) Have a nice weekend!


On 14 June 2013 15:17, NCorbet <[email protected]> wrote:

Julio,

Here is configuration I added to my spring file to use
JacksonJaxbJsonProvider:

<bean id="jaxbAnnotationInspector"
class="org.codehaus.jackson.xc.JaxbAnnotationIntrospector" />
<bean id="jacksonObjectMapper"
class="org.codehaus.jackson.map.ObjectMapper">
                 <property name="annotationIntrospector"
ref="jaxbAnnotationInspector" />
</bean>

<bean id="jsonProvider"
class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider" />

You need to set the jaxbAnnotationIntrospector in the ObjectMapper so it
forces Jackson to look at JaxB annotations first. This worked well for
me...until I needed to Marshall/UnMarshall abstract types. If you are ok
with mixing Jackson and Jaxb annotations then this should be no big deal
to
you ( the abstract type issue that is, the rest worked fine).

Hope that helps



--
View this message in context:
http://cxf.547215.n5.nabble.com/Using-Jackson-as-JSON-body-reader-writer-with-DOSGi-tp5729257p5729278.html
Sent from the cxf-user mailing list archive at Nabble.com.






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to