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?
Any help would be appreciated,
Cheers!
On Sun, Apr 18, 2010 at 5:12 PM, Franz Wong <franzwong_at_gmail.com> wrote:
> Thanks for providing more details :)
>
> Franz
>
> On Sun, Apr 18, 2010 at 8:21 PM, Maciej Biłas <maciej_at_inszy.org> wrote:
>>
>> 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
>>
>> ---------------------------------------------------------------------
>> 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