[weld-issues] [JBoss JIRA] Commented: (WELD-783) @EJB injection fails in @Named bean when interceptor is present

Ales Justin (JIRA) jira-events at lists.jboss.org
Tue Jan 11 08:42:49 EST 2011


    [ https://issues.jboss.org/browse/WELD-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574644#comment-12574644 ] 

Ales Justin commented on WELD-783:
----------------------------------

I've actually made the mock/test same as yours.
(my previous was bad since I added the interceptor as CDI interceptor)
And it works in JBossAS6.0.0.Final.

So, if you could raise a GlassFish issue and link it to this one.
e.g. they could reuse the same test/example as me


> @EJB injection fails in @Named bean when interceptor is present
> ---------------------------------------------------------------
>
>                 Key: WELD-783
>                 URL: https://issues.jboss.org/browse/WELD-783
>             Project: Weld
>          Issue Type: Bug
>          Components: CDI API, GlassFish Integration, Interceptors and Decorators
>    Affects Versions: 1.0.1.Final
>         Environment: Windows 7, NetBeans  6.9.1, GlassFish 3.0.1, Mojarra 2.0.2 (FCS b10), Java 1.6.0_22
>            Reporter: Alexander Hanschke
>            Assignee: Ales Justin
>              Labels: cdi, ejb, injection, interceptors
>             Fix For: 1.2.0.Beta1
>
>         Attachments: interceptor-bug.zip
>
>
> I have a @Named bean in which I'd like to inject a component, using @Inject as well as a stateless session bean, using @EJB. The ejb is accessed using the no-interface view. Both references get injected properly in that case, but when I use an interceptor on one of the methods, only the references annotated with @Inject get injected, whereas those annotated with @EJB don't.
> The interceptor doesn't need to do anything special, this behaviour occurs even if only proceed() is invoked on the invocation context - the interceptor is always invoked correctly.
> The following snippet explains the issue:
> @Named
> public class MyController {
>     @EJB
>     private MyDao dao;
>     @Interceptors(MyInterceptor.class)
>     public void control() {
>         dao.doDataAccessStuff();    /* NPE */
>     }
> }
> ---------------------------------------------------------------
> @Stateless
> public class MyDao {
>     public void doDataAccessStuff() { ... }
> }
> ---------------------------------------------------------------
> public class MyInterceptor {
>     @AroundInvoke
>     public Object intercept(InvocationContext context) throws Exception {
>         return context.proceed();
>     }
> }

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list