Paul Sandoz wrote:
> On Oct 28, 2010, at 6:15 PM, Ittay Dror wrote:
>>>>>
>>>>> But do you need to include the 311 jar in that environment?
>>>> yes, i want to annotate classes with @Path without depending on jersey-core.
>>>
>>> Why do you need the 311 jar at runtime?
>>
>> it contains all the jax-rs annotations, e.g @Path. I annotate my classes which means @Path is resolved by one class loader, and jersey uses these annotations also which means they are resolved in its class loader. So from the JVM point of view these two @Path annotations are different entities.
>
> But what i don't understand is why you require the 311 jar to be present at runtime to any classloader?
>
> I guess i don't understand what your environment is and whether it requires the 311 jar to be present at runtime as opposed to just compile time.
if i use @Path, i need @Path to be present at runtime, right?
now, i have a situation where i have several class loaders with dependencies:
common
/ \
/ \
gateway client
gateway is the one using jersey-core jar, client contains resources annotated with @Path. common contains jsr311-api. both import common (so common is not a parent, but an extension which the classloader of gateway/client checks if it can't find the class in its own class path)
prior to 1.4, when the code in jersey-core required @Path, it would have been resolved in common and when classes from client were loaded their @Path annotation was also resolved in common.
Now, since @Path is found inside jersey-core, gateway's classloader finds it in jersey-core. hence, the annotations of the resources from client are not instances of the @Path it has (because they are still resolved in common).
The package that does this is from
http://jpf.sf.net
Ittay
>
> Paul.
>