users@jersey.java.net

Re: [Jersey] ClassCastException from ProviderServices

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Mon, 25 Oct 2010 13:41:58 +0200

On Oct 25, 2010, at 1:08 PM, Imran M Yousuf wrote:

> Hi Paul,
>
> I wanted to say "embedded jetty" :). And yes the I was loading jersey
> from 2 class loaders, I guessed it, tried loading the war-classes as
> direct dependency and thus avoiding the exception. Thanks for the
> confirmation. Is there any workaround for 2 classloaders loading same
> version of jersey for such cases?
>

I am fairly sure Pavel has fixed this Jersey 1.5-ea01.

Basically when we load the class from the META-INF/service file we
check for assignability. Previously we did not because we assumed it
was a redundant check.

The META-INF/services thing is a right PITA. If anyone has any better
suggestions for each jar to declare components i am all ears. Of
course OSGi could be a solution but we cannot statically depend on that.

Paul.