I have two stateless session beans and 1 interceptor class.
In ssBean1 I inject and use a reference to ssBean2 using the @EJB
notation. ssBean1 also has a method that has an @Interceptors wrapper
that calls the interceptor class.
In my interceptor class I also want to use methods in ssBean2 so I
inject a reference using the same @EJB notation.
The problem is that if I inject a reference to ssBean2 in both ssBean1
and the interceptor class then my EJB reference in the interceptor is null.
If I don't inject ssBean2 in ssBean1 then my interceptor EJB reference
works fine.
I also found that if I have a ssBean3 class that doesn't reference
ssBean2 and calls the same interceptor before ssBean1 then the EJB
reference in the interceptor will work when its later called from ssBean1.
I attached the 5 sample classes that reproduce the issue.
If you call ssBean1.Test() a NPE is thrown in TestInterceptor. If you
comment out the EJB injection in ssBean1 then no NPE is thrown in
TestInterceptor.
Is this a bug or am I doing something wrong?
Thanks
Chrys