users@jersey.java.net

Re: [Jersey] SEVERE: A message body reader for Java type, class net.nighthawk.ifd.common.auth.UserAuthentication, and MIME media type, application/octet-stream, was not found

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 10 Feb 2009 10:44:02 +0100

On Feb 6, 2009, at 8:50 PM, Aaron Bruegl wrote:

> I will give this a try. Did 1.0 default to application/xml? I am
> just curious why 1.0 would work.
>

I fixed a bug in the JAXB message body readers. In 1.0 it was possible
to consume any media type rather than the XML-based media-types as
specified by the JAX-RS specification.

Paul.


>
> Craig McClanahan wrote:
>> Aaron Bruegl wrote:
>>> I tried today upgrading from Jersey 1.0 to 1.0.1 and 1.0.2-
>>> SNAPSHOT - and got this server side error using 1.0.1 and 1.0.2:
>>>
>>> SEVERE: A message body reader for Java type, class net.MyClass,
>>> and MIME media type, application/octet-stream, was not found
>>>
>>> Is this a known bug at all? Below is a snippet of basically what I
>>> am doing.
>>>
>>>
>>> *Client snippet*
>>>
>>> String id = "someId";
>>> Client client = Client.create();
>>> String resourceUrl = url + "resources/myClasses/" + id;
>>>
>>> WebResource r = client.resource(resourceUrl);
>>> MyClass myClass = new MyClass();
>>> myClass.setId(id);
>>> String s = r.put(u);
>> It looks like you are not specifying a content type on this
>> request, so it will default to "application/octet-stream". You
>> probably want something like this instead (assuming that "u" is
>> something for which the client can create XML content):
>>
>> String s = r.type("application/xml").put(u);
>>
>> Craig
>>
>>>
>>> *Server snippet*
>>> @PUT
>>> @Consumes("application/xml")
>>> @Produces("text/plain")
>>> public void putXml(@PathParam("id")
>>> String id, MyClass content) throws AuthenticationException
>>> {
>>> ...
>>> return content.getId();
>>> }
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> --
> Aaron Bruegl
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>