[jboss-jira] [JBoss JIRA] (JBWEB-224) No injection in AsyncListener in AS 7.1

arjan tijms (JIRA) jira-events at lists.jboss.org
Fri Jan 13 17:27:21 EST 2012


arjan tijms created JBWEB-224:
---------------------------------

             Summary: No injection in AsyncListener in AS 7.1
                 Key: JBWEB-224
                 URL: https://issues.jboss.org/browse/JBWEB-224
             Project: JBoss Web
          Issue Type: Bug
      Security Level: Public (Everyone can see)
            Reporter: arjan tijms
            Assignee: Remy Maucherat


Using JBoss AS 7.1CRb I have defined the following Servlet AsyncListener:

{code}
@ManagedBean
public class AsyncServletListener implements AsyncListener {
    
    @Inject
    private AsyncBean asyncBean; 
    
    @Override
    public void onStartAsync(AsyncEvent event) throws IOException {
        System.out.println("onStartAsync");
    }
    
    @Override
    public void onComplete(AsyncEvent event) throws IOException {
        System.out.println("onComplete");
    }
 
    @Override
    public void onError(AsyncEvent event) throws IOException {
        System.out.println("onError");
    }
 
    @Override
    public void onTimeout(AsyncEvent event) throws IOException {
        System.out.println("onTimeout");
    }
}
{code}

I registered this listener on an AsyncContext as follows:

{code}
AsyncContext asyncContext = request.startAsync();
asyncContext.addListener(asyncContext.createListener(AsyncServletListener.class));
{code}

The listener is called correctly, but there's no injection happening. Everything is inside a single war and the mandatory empty beans.xml has been created. JBoss AS is indeed starting up CDI ("Starting weld service" appears in the logs).
 
If I run the same code in GlassFish, injection does happen.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list