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 )'
> org.apache.wink.server.internal.handlers.FlushResultHandler.handleResponse
> , 'Could not find a writer for [B and application/octet-stream. Try to find
> JAF DataSourceProvider'
> com.sun.activation.registries.LogSupport.log , 'MailcapCommandMap:
> createDataContentHandler for application/octet-stream'
> org.apache.wink.server.internal.handlers.FlushResultHandler.handleResponse
> , 'The system could not find a javax.ws.rs.ext.MessageBodyWriter or a
> DataSourceProvider class for the [B type and application/octet-stream
> mediaType. Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the
> JAX-RS application for the type and media type specified.'
> ...
>
> RawType: interface javax.ws.rs.ext.MessageBodyReader
> Data Map:
> ...
> MediaType key = */*
> ObjectFactory Set value = {
> }
> ...
> MediaType key = application/octet-stream
> ObjectFactory Set value = {
> }
> ...
>
>
> RawType: interface javax.ws.rs.ext.MessageBodyWriter
> Data Map:
> ...
> MediaType key = */*
> ObjectFactory Set value = {
> }
> ...
> MediaType key = application/octet-stream
> ObjectFactory Set value = {
> }
> ...
>
> RawType: interface javax.ws.rs.ext.ContextResolver
> Data Map: {empty}'
>
>
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
--
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/