users@jersey.java.net

Re: [Jersey] Provider not getting detected properly

From: Chris Carrier <ctcarrier_at_gmail.com>
Date: Tue, 2 Feb 2010 09:27:02 -0800

Yeah that worked great thanks for the speedy help! So where was the
services clash coming from? I didn't even have a 'services' folder
since I was just using the Jersey defaults for my JSON providers. So
was there a clash happening between the jersey core and jersey server
jars? I could try using the shade plugin but I'm not familiar with it
so need to read up a little.

Thanks again!
Chris


On Tue, Feb 2, 2010 at 7:58 AM, Jakub Podlesak <Jakub.Podlesak_at_sun.com> wrote:
> On Tue, Feb 02, 2010 at 10:49:09AM +0100, Paul Sandoz wrote:
>>
>> 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.
>
> Just closed the issue and provided some more info there
> on how to solve it using maven shade plugin.
>
> Chris, could you let us know, if it works for you?
>
> Thanks,
>
> ~Jakub
>
>
>>
>> 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
>> >
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>