Luciano Resende <[email protected]> wrote on 03/04/2013 05:18:26: > From: Luciano Resende <[email protected]> > To: [email protected], > Cc: [email protected] > Date: 03/04/2013 05:18 > Subject: Re: wink unable to find writer for byte[] > > On Tue, Apr 2, 2013 at 7:10 AM, Anton Piatek1 <[email protected]> wrote: > My software has a rest call which returns a byte[], it is fairly simple as: > Response.ok(data).type("application/octet-stream").build(); > > This was working fine, until we upgraded from java 6 to java 7. Now > I get an internal error. Getting some detailed logging information I > see the below in the log. > It suggests that wink does not have a writer that can work out what > to do with a byte[]. Does anyone know if something changed between > java 6 and 7 which might mean I have to explicitly tell wink how to > write a byte array? I would assume there is some way to register > this manually, but I can't find it for wink... > > org.apache.wink.common.internal.registry.ProvidersRegistry.getMessageBodyWriter > , 'Getting MessageBodyWriter for class type class [B, genericType > class [B, annotations [@javax.ws.rs.GET(), @javax.ws.rs.Path(value= > {dataStoreName}/{msgId})], and media type application/octet-stream' > org.apache.wink.common.internal.registry.ProvidersRegistry > $MediaTypeMap.getProvidersByMediaType , 'Getting providers by media > type by calling getProvidersByMediaType(application/octet-stream, class [B)' > org.apache.wink.common.internal.registry.ProvidersRegistry > $MediaTypeMap.getProvidersByMediaType , 'Get media type to providers > cache for media type application/octet-stream resulted in []' > org.apache.wink.common.internal.registry.ProvidersRegistry.getMessageBodyWriter > , 'Found possible MessageBodyWriter ObjectFactories []' > org.apache.wink.common.internal.registry.ProvidersRegistry.getMessageBodyWriter > , 'No MessageBodyWriter returned true for isWriteable( class [B, > class [B, [@javax.ws.rs.GET(), @javax.ws.rs.Path(value= > {dataStoreName}/{msgId})], application/octet-stream )' ....
> > What version of Wink are you using ? If you are using IBM JDK 7.0 > you must upgrade to Wink 1.2.1 which has a fix for some specific > issues related to IBM JDK 7. > > As for registering you MessageBodyWriter and MessageBodyWriter in > the application file, see a simple example in > > https://svn.apache.org/repos/asf/wink/sandbox/lresende/sample-jaxrs-webapp/ > > Where the MBW is registered in > > https://svn.apache.org/repos/asf/wink/sandbox/lresende/sample-jaxrs- > webapp/src/main/webapp/WEB-INF/application Yes I was on 1.2.0 and moving up to 1.2.1 has now fixed my issue. Thanks very much for the help! Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
