Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-7841

ManagedScheduledExecutorService could not find EntityManager produced by CDI producer. No active context.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • 10.0.0.Final, 10.1.0.Final
    • CDI / Weld
    • None

    Description

      The problem is that EntityManager does not have managed delegate within a job executed by ManagedScheduledExecutorService#scheduleAtFixedRate().
      The EntityManager is produced by CDI producer and entire web application is able to work with injected EntityManager except for the jobs.
      I tried to schedule executing the job in two ways and both finished with same issue (No managed context in EntityManager) :

      • @ApplicationScoped job instance was passed to executor from caller.
      • The job was changed to RequestScoped and ContextProxy#createContextualProxy() created the Job bean instance and then I called scheduleAtFixedRate(job, 5, 60, SECONDS)

      It looks to me that javax.enterprise.concurrent has a different BeanManager and therefore has no notion about my CDI Producer of EntityManager. The producer is regular producer of EntityManager in JavaEE.

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            tibor17 Tibor Digana (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: