Hi Sergey, Thank you for your response. I have now found my problem: something was wrong with my project's classpath. I don't know precisely what happened, but I eventually tried switching to CXF 2.1.3 to see if the version was the problem (currently using 2.2-SNAPSHOT) which introduced other issues. I reverted to 2.2-SNAPSHOT and everything worked fine. I suppose the issue also could have been Eclipse failing to keep my Tomcat deployment in sync with the project... *shrug*
My client is sending the proper Content-Type, it was just some other type of oversight on my part. :) Thank you for (always) looking into the issue! - Dave Sergey Beryozkin-3 wrote: > > Hi Dave > > I've created a simple test which uses the same sample service and > provider, the only difference was that I registered a provider > programmatically, and I've had no problems invoking the service > > Can you please check, using some tcptrace utility, a ContentType of a > given request ? LOG.fine also prints a request ContentType... > > Cheers, Sergey > > ----- Original Message ----- > From: "Sergey Beryozkin" <[email protected]> > To: <[email protected]> > Sent: Monday, January 19, 2009 11:59 AM > Subject: Re: Problem with MessageBodyReader provider > > >> Dave - >> >> Can you just confirm please that an actual Content-Type of the request is >> indeed multipart/mixed ? May be it's some sort of a >> case-sensitive comparison issue ? >> >> Cheers, Sergey >> >>> Hi Dave >>> >>> I'll have a look asap, need to complete CXF-1982 >>> >>> Cheers, Sergey >>> >>> ----- Original Message ----- >>> From: "dclane" <[email protected]> >>> To: <[email protected]> >>> Sent: Friday, January 16, 2009 11:16 PM >>> Subject: Problem with MessageBodyReader provider >>> >>> >>>> >>>> Hi All, >>>> >>>> I have a custom provider class for MultipartRequest objects which isn't >>>> working. It is instantiated without incident when my application >>>> context is >>>> loaded, but I hit a RuntimeException ("No message body reader found for >>>> target class MultipartRequest, content type: multipart/mixed") whenever >>>> I >>>> try to use the service. >>>> >>>> I believe my configuration/annotations/everything are correct, and have >>>> even >>>> tried stripping out all but the simplest code from my MultipartProvider >>>> in >>>> order to make something work. >>>> >>>> ----- applicationContext.xml ----- >>>> <jaxrs:server id="service" address="/rs"> >>>> <jaxrs:serviceBeans> >>>> <bean id="myService" class="com.company.MyServiceBean"/> >>>> </jaxrs:serviceBeans> >>>> <jaxrs:providers> >>>> <bean id="multipartProvider" class="com.company.MultipartProvider"/> >>>> </jaxrs:providers> >>>> </jaxrs:server> >>>> >>>> ----- MyServiceBean.java ----- >>>> @Path( "/service/{serviceId}" ) >>>> public class MyServiceBean { >>>> @POST >>>> @Path( "/doThings" ) >>>> public Response doThings( @PathParam( "serviceId" ) String >>>> serviceId, >>>> MultipartRequest multipartRequest ) { >>>> // do things here. >>>> } >>>> } >>>> >>>> ----- MultipartProvider.java ----- >>>> @Consumes( "multipart/mixed" ) >>>> @Provider >>>> public class MultipartProvider implements >>>> MessageBodyReader<MultipartRequest> { >>>> >>>> public boolean isReadable( Class<?> type, Type genericType, >>>> Annotation[] >>>> annotations, MediaType mt ) { >>>> return MultipartRequest.class.isAssignableFrom( type ); >>>> } >>>> >>>> public MultipartRequest readFrom( Class<MultipartRequest> clazz, >>>> Type >>>> genericType, Annotation[] annotations, MediaType m, >>>> MultivaluedMap<String, >>>> String> headers, InputStream is ) throws IOException { >>>> MultipartRequest multipartRequest = new >>>> DefaultMultipartHttpServletRequest(null,null,null); >>>> return multipartRequest; >>>> } >>>> } >>>> ---------- >>>> >>>> The MyService.java code isn't important at the moment, because I can't >>>> get >>>> past the method call due to the (missing?) provider problem. >>>> >>>> The Content-Type is definitely getting set by the client (the >>>> server-side >>>> error message shows the request's Content-Type). I've tried switching >>>> the >>>> types recognized by my MultipartProvider's @Consumes annotation and >>>> setting >>>> it to "*/*" (and tried removing the parameter altogether, which should >>>> make >>>> it attempt to work with any type, right?), but the provider is never >>>> picked >>>> up. >>>> >>>> Am I annotating things incorrectly or improperly referencing the >>>> provider in >>>> my applicationContext.xml? I've made MessageBodyWriter providers >>>> before and >>>> don't see much a of difference... >>>> >>>> Maybe a fresh set of eyes can help me out. ;) >>>> >>>> Thank you, >>>> - Dave >>>> >>>> P.S. If it matters, I'm running Tomcat 5.5. >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/Problem-with-MessageBodyReader-provider-tp21510459p21510459.html >>>> Sent from the cxf-user mailing list archive at Nabble.com. >>>> >> > > > -- View this message in context: http://www.nabble.com/Problem-with-MessageBodyReader-provider-tp21510459p21556227.html Sent from the cxf-user mailing list archive at Nabble.com.
