Hi

On Sat, May 21, 2011 at 12:07 PM, Stefan Henke <[email protected]> wrote:
> Hi,
> I´m currently trying to register a custom MessageBodyWriter for my jax-rs 
> service in order to serialize a very specific object my service is returning. 
> Unfortunately, I´m getting a "No message body has been found..." error when 
> calling the service.
> I´m doing the following:
> 1) Providing a class implementing javax.ws.rs.ext.MessageBodyWriter which is 
> also annotated with @Provider.
> 2) Additionally, I added the following init parameter to the 
> CXFNonSpringJaxrsServlet in web.xml:
> <init-param>
> <param-name>jaxrs.providers</param-name>
> <param-value>com.d.MyMessageBodyWriter</param-value>
> </init-param>
>
> Is there anything I´m missing or is there a completely different way of 
> achieving what I need?
> Waiting for your help ;-)

When CXF JAX-RS selects a writer, it checks if @Consumes annotation
which should be available on the resource method matches that of a
current writer. If the match is successful then it checks
writer.isWriteable.
Please check:
- the provider has a correct @Consumes value
- enable FINE/TRACE logging and verify the selected method' Consumes
matches the provider's one
- make sure isWriteable returns true

HTH

Cheers, Sergey


> Best regards,
> Stefan
> --
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Reply via email to