Hi Sergey,

I tell me if it's interesting that CXF provides a servlet status (or
another thing) which list the available provider. As CXF is very modular, I
find it's hard to know which JARs you must to use when you are newbie.
This servlet status could tell this info (JSON provider is not available,
please add Jettison in your classpath for instance).

Regards Angelo


2013/8/30 Sergey Beryozkin <[email protected]>

> Hi
>
> On 30/08/13 07:27, rpd wrote:
>
>> Hi
>>
>> CXF is still very new to me and will be for sometime I guess.  My Hello
>> World service worked just fine when producing XML.  If I switch to
>> @Produces("application/json") I get the message on the client...
>>
>> "No message body writer has been found for response"
>>
>> I'm using REST with CXFNonSpringJaxrsServlet and I am sure that the
>> message
>> arises because I have not configured JSON support.
>>
>> (1) First of all which specific jars should I include in my lib?  I'm not
>> a
>> Maven user so therefore at a disadvantage here.  There are a plethora of
>> likely jar candidates (probably around 10) - things that have 'xjc' and
>> 'jaxb' in their names.  I could just include them all of course but that
>> would be really messy.
>>
>>  Default JSONProvider is in cxf-rt-rs-extensions-providers module, and
> you also need to add
> <dependency>
>     <groupId>org.codehaus.**jettison</groupId>
>     <artifactId>jettison</**artifactId>
>     <version>1.3.4</version>
> </dependency>
>
>
>  (2) Do I need to configure anything in my web.xml? I read somewhere that
>> there's a need to initialise JSONProvider.
>>
>
> If default provider is used then adding the above dependencies can be
> enough, unless you need to configure JSONProvider (ex, to support single
> element collections correctly)
>
>
>
>> (3) I notice from the docs that Jettison (the default provider) has some
>> issues like array-serialization.  I don't really want to have these issues
>> to contend with myself.  Is it easy to use, say, Jackson instead? I
>> have always found this to be a very good library when I used jaxb
>> directly.
>>
>>
> Sure, please add a Jackon dependency and list a provider in web.xml
>
> Cheers, Sergey
>
>
>  (4) Anything else I need to know?
>> Thanks for your patience.
>>
>> Rob
>>
>>
>>
>> --
>> View this message in context: http://cxf.547215.n5.nabble.**
>> com/Configure-JSON-Support-to-**avoid-No-message-body-writer-**
>> has-been-found-for-response-**tp5733320.html<http://cxf.547215.n5.nabble.com/Configure-JSON-Support-to-avoid-No-message-body-writer-has-been-found-for-response-tp5733320.html>
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>
>

Reply via email to