users@jersey.java.net

Re: [Jersey] com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java type

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 07 Dec 2009 11:19:40 +0100

Hi,

What are the following:

1) version of Jersey?

2) version of JDK?

3) dependencies?

The error indicates that JAXB is not correctly in the class path.
Sometimes this can happen in OSGi-based environments.

Paul.

On Dec 6, 2009, at 6:20 PM, blameMike wrote:

>
> I'm having an issue trying to call a post:
>
> webResource.path("drops").type("application/x-www-form-
> urlencoded
> ").accept(MediaType.APPLICATION_XML_TYPE).post(DropBean.class,
> data);
>
> My DropBean class is as follows:
>
> @XmlRootElement(name="drop")
> public class DropBean {
>
> @XmlElement(name="asset_count") public int assetCount;
> public String rss;
> @XmlElement(name="current_bytes") public int currentBytes;
> @XmlElement(name="admin_token") public String adminToken;
> @XmlElement(name="expires_at") public Date expiresAt;
> @XmlElement(name="expiration_length") public String
> expirationLength;
> @XmlElement(name="chat_password") public String chatPassword;
> @XmlElement(name="guests_can_download") public boolean
> guestsCanDownload;
> @XmlElement(name="voicemail") public String voiceMail;
> @XmlElement(name="hidden_upload_url") public String
> hiddenUploadURL;
> @XmlElement(name="max_bytes") public int maxBytes;
> @XmlElement(name="guests_can_add") public boolean guestsCanAdd;
> public String conference;
> public String email;
> @XmlElement(name="guests_can_comment") public boolean
> guestsCanComment;
> public String fax;
> public String name;
> @XmlElement(name="guests_can_delete") public boolean
> guestsCanDelete;
>
>
> @Override
> public boolean equals(Object obj) {
> if (obj == null) {
> return false;
> }
> if (getClass() != obj.getClass()) {
> return false;
> }
>
> return true;
> }
>
> @Override
> public int hashCode() {
> int hash = 7;
> hash = 59 * hash + this.assetCount;
> hash = 59 * hash + (this.rss != null ? this.rss.hashCode() :
> 0);
> hash = 59 * hash + this.currentBytes;
> hash = 59 * hash + (this.adminToken != null ?
> this.adminToken.hashCode() : 0);
> hash = 59 * hash + (this.expiresAt != null ?
> this.expiresAt.hashCode() : 0);
> hash = 59 * hash + (this.expirationLength != null ?
> this.expirationLength.hashCode() : 0);
> hash = 59 * hash + (this.chatPassword != null ?
> this.chatPassword.hashCode() : 0);
> hash = 59 * hash + (this.guestsCanDownload ? 1 : 0);
> hash = 59 * hash + (this.voiceMail != null ?
> this.voiceMail.hashCode() : 0);
> hash = 59 * hash + (this.hiddenUploadURL != null ?
> this.hiddenUploadURL.hashCode() : 0);
> hash = 59 * hash + this.maxBytes;
> hash = 59 * hash + (this.guestsCanAdd ? 1 : 0);
> hash = 59 * hash + (this.conference != null ?
> this.conference.hashCode() : 0);
> hash = 59 * hash + (this.email != null ?
> this.email.hashCode() : 0);
> hash = 59 * hash + (this.guestsCanComment ? 1 : 0);
> hash = 59 * hash + (this.fax != null ? this.fax.hashCode() :
> 0);
> hash = 59 * hash + (this.name != null ?
> this.name.hashCode() : 0);
> hash = 59 * hash + (this.guestsCanDelete ? 1 : 0);
> return hash;
> }
>
> The entire error is:
>
> com.sun.jersey.api.client.ClientHandlerException: A message body
> reader for
> Java type, class DropBean, and MIME media type,
> application/xml;charset=utf-8, was not found
>
> Has anyone run into this error before? Any help would be greatly
> appreciated!
>
> --
> View this message in context: http://n2.nabble.com/com-sun-jersey-api-client-ClientHandlerException-A-message-body-reader-for-Java-type-tp4122001p4122001.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>