Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-8792

No request scope during an EJB timeout method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 6.0.0.CR1, 6.0.0.Final
    • Weld/CDI
    • None

      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 ...

              marius.bogoevici Marius Bogoevici (Inactive)
              adamw_jira Adam Warski (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: