users@jersey.java.net

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

From: Franz Wong <franzwong_at_gmail.com>
Date: Tue, 20 Apr 2010 07:21:02 +0800

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