users@jersey.java.net

Re: [Jersey] jersey-multipart throwing NPE

From: Gili <cowwoc_at_bbs.darktech.org>
Date: Sat, 22 Nov 2008 23:37:06 -0800 (PST)

FYI: If you use jersey 1.0.1 with jersey-multipart 1.0.1 the jersey-multipart
providers are picked up automatically. You no longer need to manually load
them using a custom Client configuration.

Gili


Craig McClanahan wrote:
>
> Gili wrote:
>> It turns out this is caused by the fact that "@Context MultiPartConfig
>> config" in the constructor returns null. The thing is, the Javadoc
>> doesn't
>> explain if I'm supposed to provide some sort of configuration and if so
>> how
>> to do it. I could really use your help ;)
>>
>>
> Yep, that is definitely the root cause. I just added an error message
> to the constructor of MultiPartReader that will complain (the first time
> this class is instantiated) if the config bean cannot be found. (+1 to
> maximally helpful exception messages.)
>
> This should *never* happen on the server side unless you have done
> something really strange with the Jersey configuration parameters. On
> the client side, as we've discusssed, you need to explicitly register
> the provider class.
>
> Note that there has been a package rename recently in this as well as
> many other areas ... but if you had initialized the client as indicated
> in your earlier email:
>
> config.getClasses().add(MultiPartConfigProvider.class);
>
> you would have gotten a compile error if you didn't update your import
> statement. So I suspect that this error is happening on the client
> side, and that you haven't registered this particular provider.
>
> Try the latest jersey-multipart code with no other changes, and you
> should receive an IllegalArgumentException that discusses the root cause
> more clearly.
>
>> BTW, I see "com.sun.jersey.multipart.impl.MultiPartConfigProvider" being
>> loaded by Jersey on startup so I am expecting this to work...
>>
>>
> Could you cut-n-paste the system out log that shows this?
>> Thanks,
>> Gili
>>
>>
> Craig
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
>

-- 
View this message in context: http://n2.nabble.com/jersey-multipart-throwing-NPE-tp1560622p1567786.html
Sent from the Jersey mailing list archive at Nabble.com.