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
>>
>
>