users@jersey.java.net

Re: [Jersey] Provider not getting detected properly

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 02 Feb 2010 10:49:09 +0100

On Feb 2, 2010, at 10:31 AM, Jakub Podlesak wrote:

>
> Hi Chris,
>
> i believe this is related to the issue [1],

Yes, it could well be that. I kept this issue open waiting for
feedback from the developer, but have not received anything so will
close it soon.

If you re-package Jersey you need to be careful about the META-INF/
service files.

Paul.

> could you please try to change the dependency
> definition in your pom to use only the jersey-bundle
> module instead of the individual jersey modules and re-try?
>
> Does it work?
>
> ~Jakub
>
> [1]https://jersey.dev.java.net/issues/show_bug.cgi?id=440
>
> On Mon, Feb 01, 2010 at 05:31:07PM -0800, Chris Carrier wrote:
>> OK so I have a very strange problem that I don't have a good solution
>> for so I'm hoping someone can shed some light on it. I'm creating
>> JSON services and letting JAXB handle the marshalling. This works
>> fine when I run my code via my IDE (IntelliJ). It runs the code
>> directly via my main() method. The problem is when I package the
>> code
>> into a jar and try to run on the command line I get an error:
>>
>> SEVERE: A message body writer for Java type, class com.some.Class,
>> and
>> MIME media type, application/json, was not found
>>
>> This is 100% consistent. I run in the IDE and it works then I try
>> with the JAR and it explodes. I added a log line like this:
>>
>> log.info("PROVIDERS " +
>> ps.getMessageBodyWriter(RedirectLinkCollection.class, null, null,
>> MediaType.APPLICATION_JSON_TYPE));
>>
>> And sure enough in the IDE it prints:
>>
>> PROVIDERS
>> com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider
>> $App_at_1925d92c
>>
>> While from the JAR it prints:
>>
>> PROVIDERS null
>>
>> Any ideas? I'm bundling all dependencies directly into my JAR and I
>> can attest to the fact that the class is in there. I can work around
>> this by writing my own JSON writer but I would rather leverage the
>> JAXB automagic stuff.
>>
>> Chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
> --
> http://blogs.sun.com/japod
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>