[jboss-jira] [JBoss JIRA] Created: (JBAS-8792) No request scope during an EJB timeout method

Adam Warski (JIRA) jira-events at lists.jboss.org
Fri Jan 7 13:14:17 EST 2011


No request scope during an EJB timeout method
---------------------------------------------

                 Key: JBAS-8792
                 URL: https://issues.jboss.org/browse/JBAS-8792
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Weld/CDI
    Affects Versions: 6.0.0.Final, 6.0.0.CR1
            Reporter: Adam Warski
            Assignee: Marius Bogoevici


Since AS6 CR1, during an EJB timeout method, when trying to use request-scoped beans, I am getting an exception: "No active contexts for scope type javax.enterprise.context.RequestScoped". According to specs, this should work.

As a temporary workaround, I am registering a request context by hand:

        @Inject
        BoundRequestContext requestContext;

        Map<String, Object> context = new HashMap<String, Object>();
        try {
            requestContext.associate(context);
            requestContext.activate();

            // Do the timeout stuff
        } finally {
            requestContext.invalidate();
            requestContext.deactivate();
            requestContext.dissociate(context);
        }

Btw. I tried doing this with an interceptor, but it seems that neither EJB interceptors or CDI interceptors work with timers ...

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

        


More information about the jboss-jira mailing list