users@jersey.java.net

[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 08:27:01 +0200

Hello,

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./

VDCType is a class generated from an XSD file using JAXB XJC plugin for
Eclipse. And the error triggers when I try to send a response to the
client containing an instance of that class:

return Response.ok(vdc, "application/vdc+xml").build();

This is the VDCType class:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VDC_Type", namespace = "http://schemas/...", propOrder = {
     "type",
     "storageCapacity",
     "computeCapacity",
     "availableNetworks"
})
public class VDCType extends EntityType
{
     @XmlElement(name = "Type", namespace = "http://schemas/...")
     protected String type;
     @XmlElement(name = "StorageCapacity", namespace = "http://schemas/...")
     protected VDCType.StorageCapacity storageCapacity;
     @XmlElement(name = "ComputeCapacity", namespace = "http://schemas/...")
     protected VDCType.ComputeCapacity computeCapacity;
     @XmlElement(name = "AvailableNetworks", namespace =
"http://schemas/...")
     protected VDCType.AvailableNetworks availableNetworks;

     /**
      * Gets the value of the type property.
      *
      * @return
      * possible object is
      * {_at_link String }
      *
      */
     public String getType() {
         return type;
     }
     ...

I have read that maybe I have to implement my own message body writer,
but I am not sure on how to do it. Can anyone give me a clue?

Thank you.

-- 
Javi