On Oct 16, 2008, at 11:35 AM, Chrys Rowe wrote:
> Hi
>
> Removing the name attribute seems to fix the problem.
OK, good. Thanks for trying that.
>
> Do you think this is a bug in Glassfish or JavaEE?
Glassfish. The @EJB name is used to uniquely identify the EJB
dependency
within the component's environment. The interceptor shares the same
component
environment as the bean so the spec does allow them to essentially
share the
same dependency by using the same name. There's probably just some bug
in handling that case. When you leave off the name() attribute, the
dependency
is automatically assigned a default name that is unique, so there
isn't a clash.
Could you file a bug with your original code example?
https://glassfish.dev.java.net/servlets/ProjectIssues
Thanks.
--ken
>
>
> Chrys
>
>
>
>> On Oct 16, 2008, at 8:16 AM, Chrys Rowe wrote:
>>> 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?
>>>
>> Sounds like a bug. Can you remove the name() attribute from the @EJB
>> annotations and see if you still get the NPE?
>> --ken
>>> Thanks
>>> Chrys
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>