users@jersey.java.net

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

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 22 Apr 2010 17:22:25 +0200

On Apr 22, 2010, at 4:50 PM, Beatriz Nombela wrote:

> Hi Paul,
>
> It is specified at the end of the following link:
> http://docs.sun.com/app/docs/doc/819-3659/beadf?a=view :
>
> "The default value is delegate="true", which causes the Web class
> loader to delegate in the same manner as the other class loaders. You
> must use delegate="true" for a web application that accesses EJB
> components or that acts as a web service client or endpoint."
>

Oh crap, i did not know that.

Ah, i think i may have worked it out:

Try this in the int-test pom:

             <plugin>
                 <groupId>org.glassfish</groupId>
                 <artifactId>maven-embedded-glassfish-plugin</
artifactId>
                 <version>3.0</version>
                 <dependencies>
                     <dependency>
                         <groupId>org.codehaus.jackson</groupId>
                         <artifactId>jackson-mapper-asl</artifactId>
                         <version>${jackson-version}</version>
                         <scope>test</scope>
                     </dependency>
                     <dependency>
                         <groupId>com.sun.jersey</groupId>
                         <artifactId>jersey-server</artifactId>
                         <version>${jersey-version}</version>
                     </dependency>

namely override the dependency that is added by GF embedded and retain
class loader delegation as true.

Paul.

> I've attached another sample closer to my application. There are two
> more modules: ejb and ear. The way to test it is the same than before.
> You will see that if delegate="true", the EJB's will be created, but
> version of Jackson library would be incorrect. If delegate="false", my
> application will use Jackson 1.5, but there will be a lot of
> exceptions due to errors creating the EJB.
>

OK.

Paul.