users@glassfish.java.net

Re: Interceptors and classpaths

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Tue, 05 Apr 2011 12:19:37 -0400

Laird,

jars in an ear will be loaded by their own classloaders. You can inject
beans across the jars, but you need to have a common lib with
interfaces. You can try to put the interceptor there as well, but I
don't think I tested such scenario.

Best,
-marina

Laird Nelson wrote:
> Before I haul off and go waste some time trying to put this together,
> I thought I'd ask:
>
> Suppose I have two EJB jars in an ear, A and B.
>
> Suppose I have an interceptor class, com.foo.Interceptor, in B that I
> would like to install as an interceptor for an EJB in A. That is, A
> knows nothing about B or any of its classes, but a B class would like
> to act as an interceptor for an EJB in A.
>
> If I modify A's ejb-jar.xml (we're talking EJB 3.1 here) so that it
> lists com.foo.Interceptor as an interceptor class, will that class be
> found?
>
> Finally, since an Interceptor may also be the target of dependency
> injection, but is tied to the ENC of the bean for which it is an
> interceptor, can my interceptor-from-B have an instance of A's EJB
> injected into it?
>
> Thanks,
> Laird