users@jersey.java.net

Re: [Jersey] A message body writer for Java type [...] and MIME media type [...] was not found

From: Javier Alvarez <javier.alvarez_at_bsc.es>
Date: Wed, 12 May 2010 17:08:23 +0200

Hello Pavel,

Find a little eclipse project attached. You can deploy the generated war
on tomcat and then run the src/test/java/ServiceTester class (it will
asume http://localhost:8080 as tomcat's URL).

Thank you.

On 12/05/10 16:03, Pavel Bucek wrote:
> Hello Javier,
>
> can you provide minimal failing test-case (preferably maven project)?
> I will look into it, but this would save my time..
>
> thanks,
> Pavel
>
> On 5/12/10 9:07 AM, Javier Alvarez wrote:
>> Hi Moises,
>>
>> I forgot to say that I get the error when invoking the following POST
>> method:
>>
>> @POST
>> @Consumes ("application/vdc+xml")
>> @Path ("/vdc/action/add")
>> public Response addVDC (VDCType vdc)
>> {
>> System.out.println(vdc.getName());
>>
>> return Response.ok(vdc, "application/vdc+xml").build();
>> }
>>
>> And then:
>>
>> - If I add @XmlRootElement to the VDCType class I get an HTTP 400
>> Response saying that the sent resource is sintactically incorrect and
>> the method above prints nothing.
>>
>> - Without the @XmlRootElement I can invoke the method and it prints
>> the correct name, but it crashes when returning.
>>
>> By the way, if I change the type to "application/xml" I have the same
>> problem.
>>
>> Thank you.
>>
>> On 12/05/10 08:34, Moises Lejter wrote:
>>> Maybe you should designate your class as @XmlRootElement, too ?
>>> I would have expected that the default XML encoding would be
>>> acceptable, even though you say "application/cvd+xml", and not just
>>> "application/xml" ...
>>>
>>> Moises
>>>
>>> On May 12, 2010, at 1:27 AM, Javier Alvarez wrote:
>>>
>>>> I am developing a RESTful Web Service using Jersey and I
>>>> encountered a problem. The error is the following:
>>>>
>>>> /A message body writer for Java type, class VDCType, and MIME media
>>>> type, application/vdc+xml, was not found./
>>>
>> --
>> Javi
>


-- 
Javi