users@jersey.java.net

Re: [Jersey] Conflict when using Jersey and Jackson json

From: Maciej Biłas <maciej_at_inszy.org>
Date: Sun, 18 Apr 2010 14:21:46 +0200

Hey,

From what I can tell the VerifyError does not come from a difference
between asl and lgpl versions. It's rather a binary incompatibility
that was introduced in Jackson 1.3.

You can read more in this blog:
http://jackson-users.ning.com/profiles/blogs/compatibility-or-lack-thereof

Best wishes,
Maciej

On Sat, Apr 17, 2010 at 5:25 AM, Franz Wong <franzwong_at_gmail.com> wrote:
> Hi Tatu,
>
> Changing to "asl" is ok for me, because only the test cases use it. It 'd be
> better if the version used by jersey can be upgraded.
>
> Franz
>
> On Sat, Apr 17, 2010 at 1:13 AM, Tatu Saloranta <tsaloranta_at_gmail.com>
> wrote:
>>
>> Having 2 differently named but effectively same jars ("asl" and
>> "lgpl") for Jackson is unfortunate, but seemed necessary for dual
>> licensing.
>>
>> At any rate, you should really just have instances of one and not the
>> other; contents are the same minus included license file. So in your
>> care, maybe you can just change tests to refer to 'asl' variant?
>>
>> -+ Tatu +-
>>
>> On Fri, Apr 16, 2010 at 4:04 AM, Franz Wong <franzwong_at_gmail.com> wrote:
>> > Hi Paul,
>> > I found out the problem. "jersey-json" contains a dependency
>> > "jackson-core-asl" (version 1.1.1). The one I used in test case is
>> > "jackson-core-lgpl" (version 1.5.1) These two dependencies create the
>> > conflict.
>> > Since I am not able to exclude "jackson-core-asl" only for test scope in
>> > maven, I can only abandon using the lgpl version and change to use asl
>> > version for my test case.
>> > Thanks.
>> > Franz
>> > On Fri, Apr 16, 2010 at 6:09 PM, Paul Sandoz <Paul.Sandoz_at_sun.com>
>> > wrote:
>> >>
>> >> Hi Franz,
>> >>
>> >> Can you send a running test case (preferably a maven project) that way
>> >> it
>> >> will be easier to investigate.
>> >>
>> >> This type of error is often indicative of compiling against one version
>> >> while running against another version.
>> >>
>> >> Paul.
>> >>
>> >> On Apr 16, 2010, at 5:10 AM, Franz Wong wrote:
>> >>
>> >>> Hi,
>> >>>
>> >>> I made a webapp using Jersey. After that, I wrote unit tests for it.
>> >>> The
>> >>> test data is in json format and parsed by jackson json. The object
>> >>> will be
>> >>> input to the business layer class for test. Every time I run it, error
>> >>> occurred.
>> >>>
>> >>> Later, I created a simple project with only an entity class and a unit
>> >>> test class. When I just included the jackson json dependency in maven,
>> >>> everything run smoothly. However, when I added jersey dependency, the
>> >>> same
>> >>> error occurred.
>> >>>
>> >>> Originally, I would like to use the jersey built-in json support for
>> >>> my
>> >>> unit test. Since my test is not at service layer, I cannot get the
>> >>> Providers
>> >>> instance, hence I cannot get the MessageBodyReader instance.
>> >>>
>> >>> Thanks.
>> >>> Franz
>> >>>
>> >>> the error :
>> >>>
>> >>> java.lang.VerifyError: (class: org/codehaus/jackson/map/ObjectMapper,
>> >>> method: writeValueAsBytes signature: (Ljava/lang/Object;)[B)
>> >>> Incompatible
>> >>> argument to function
>> >>>
>> >>> my test :
>> >>>
>> >>> ObjectMapper objMapper = new ObjectMapper();
>> >>> User user = (User) objMapper.readValue("{\"name\" : \"franzwong\",
>> >>> \"itemList\" : [\"apple\", \"orange\"]}", User.class);
>> >>> Assert.assertEquals("franzwong", user.getName());
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>>
>
>



-- 
Maciej Biłas