users@jersey.java.net

Re: [Jersey] Help with JacksonJSONProvider and Glassfish

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 03 Mar 2010 18:37:02 +0100

On Mar 3, 2010, at 6:13 PM, Chris Carrier wrote:

> Are you packaging as an uber war? If so after you package open up
> your resulting WAR file and make sure your files under the services
> directory are still what you expect them to be. I had an issue when
> packaging uber *ar that dependent jars had provider files that were
> stomping mine.
>

Also, where exactly did you place the META-INF/services directory? it
should be under WEB-INF/classes or within the jar file in WEB-INF/lib.

Two other solutions:

1) place the names of the classes in a file META-INF/services/jersey-
server-components
      that way the classes will get logged and you do not required to
know the provider interface

2) register an instance of javax.ws.rs.core.Application, e.g. reusing
say PackagesResourceConfig and
      explicitly register the Jackson provider classes or instances as
you require.

Paul.

> Chris
>
> On Wed, Mar 3, 2010 at 1:49 AM, John Lister <john.lister_at_kickstone.co.uk
> > wrote:
>> Hi I'm trying to port a legacy application which has some nuances
>> in the way
>> it expects JSON to be output, all of which seem to be resolved if I
>> use the
>> Jackson provider, however I'm struggling to get it to work with
>> glasfish.
>> I've looked at the samples and various other articles on the web,
>> but none
>> deal with web applications (war files) or glassfish, only jar
>> files. Taking
>> the jersey sample, I've created a services directory within the war
>> file
>> META-INF directory and placed the two files in there specifying the
>> jackson
>> provider for reading and writing. But this doesn't seem to get
>> work, I've
>> also added all the latest jackson jar files to the project with no
>> success.
>>
>> Have I missed something, or does this not work as I'd like?
>>
>> Thanks
>>
>> ---------------------------------------------------------------------
>> 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
>