users@jersey.java.net

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

From: Beatriz Nombela <beaotx_at_gmail.com>
Date: Tue, 20 Apr 2010 11:43:13 +0200

Hi,

I'm using the glassfish-embedded-all that ships with
maven-embedded-glassfish-plugin, version 3.0. As you've said, that GF
ships with Jersey (1.1.4.1), accordingly it comes with the Jackson
core library. I specified the Jersey dependency as provided, but it's
the same.

Thanks for your attention.



On Tue, Apr 20, 2010 at 11:29 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
> Hi,
>
> What is your pom? a simple test executable test case may help.
>
> If you are using the jersey-test-framework then it does declare some
> unwanted dependencies (this has been fixed for 1.2-SNAPSHOT).
>
> What version of embedded GF are you using? Jersey is shipped with GF v3 and
> GF v3 embedded and that does ship with jersey json stuff which in turn ships
> with the jackson core library.
>
> Paul.
>
> On Apr 20, 2010, at 11:18 AM, Beatriz Nombela wrote:
>
>> Hi,
>>
>> Thanks for your answers. I've specified version 1.5 of Jackson with my
>> tests, but I'm getting the same error. Also, I've looked through the
>> output maven with -X parameter, but I don't see any other version of
>> Jackson as 1.5.
>>
>> I've changed Jackson version to the previous that I was using, 1.4.3.
>> If in my test I do a GET to a resource, it works, but doing a POST I
>> get the following error:
>>
>> java.lang.NoSuchMethodError:
>> org.codehaus.jackson.type.JavaType.isConcrete()Z
>>       at
>> org.codehaus.jackson.map.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:80)
>>       at
>> org.codehaus.jackson.map.deser.StdDeserializerProvider._createDeserializer(StdDeserializerProvider.java:315)
>>       at
>> org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:246)
>>       at
>> org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCacheValueDeserializer(StdDeserializerProvider.java:226)
>>       at
>> org.codehaus.jackson.map.deser.StdDeserializerProvider.findValueDeserializer(StdDeserializerProvider.java:110)
>>       at
>> org.codehaus.jackson.map.ObjectMapper._findRootDeserializer(ObjectMapper.java:1349)
>>       at
>> org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:1282)
>>       at
>> org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:927)
>> ......
>>
>> I don't understand what's going on, maybe the embedded Glassfish
>> overrides any library? I'll continue with it.
>>
>>
>>
>> On Tue, Apr 20, 2010 at 1:21 AM, Franz Wong <franzwong_at_gmail.com> wrote:
>>>
>>> I used maven 's -X parameter to trace for dependency resolving. That may
>>> be
>>> useful.
>>> Franz
>>> On Tue, Apr 20, 2010 at 6:55 AM, Tatu Saloranta <tsaloranta_at_gmail.com>
>>> wrote:
>>>>
>>>> On Mon, Apr 19, 2010 at 3:51 PM, Beatriz Nombela <beaotx_at_gmail.com>
>>>> wrote:
>>>>>
>>>>> Hi all,
>>>>>
>>>>> I'm having the same error:
>>>>>
>>>>> java.lang.VerifyError: (class: org/codehaus/jackson/map/ObjectMapper,
>>>>> method: writeValueAsBytes signature: (Ljava/lang/Object;)[B)…
>>>>>
>>>>> I have an .ear application, with a war module that uses Jersey (v.
>>>>> 1.1.5.1). I'm des/serializing with Jackson (v. 1.5.1), registering the
>>>>> JacksonJsonProviders provided with jackson-jaxrs in my class extending
>>>>> javax.ws.rs.Application. I have a @Provider class that configures
>>>>> ObjectMapper for that purpose. If I deploy my .ear in a Glassfish v3,
>>>>> my application works perferctly, but when I execute my tests in an
>>>>> embedded Glassfish (through maven-embedded-glassfish-plugin), I get
>>>>> the VeriryError exception. The error occurs just when I try to
>>>>> instantiate ObjectMapper in the provider.
>>>>>
>>>>> My tests are executed with jersey-client, but I've runned them with
>>>>> http-client to see if there was a conflict with jersey-client's
>>>>> jackson version. Anyway, I get the same error.
>>>>>
>>>>> Do you know what happens? Why my application fails only in tests phase?
>>>>
>>>> It sounds like test-only maven dependencies are resolved differently
>>>> from compile/runtime dependencies. Specifically, compilation seems to
>>>> refer to newer version: writeValueAsBytes was added in Jackson 1.5,
>>>> and for some reason tests are running with an earlier version that do
>>>> not include this method. It is bit odd that exception does claim there
>>>> is a missing method.
>>>>
>>>> I don't know what is the right way to override test dependencies, but
>>>> using 1.5 version for tests should resolve the issue.
>>>>
>>>> -+ Tatu +-
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>
>>>
>>>
>>
>>
>>
>> --
>> Beatriz Nombela Escobar
>> beaotx_at_gmail.com
>>
>> ---------------------------------------------------------------------
>> 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
>
>



-- 
Beatriz Nombela Escobar
beaotx_at_gmail.com